@charset "UTF-8";

@import url("https://cdn.jsdelivr.net/npm/dialog-polyfill@0.5.6/dist/dialog-polyfill.css");

/* @import url("https://fonts.googleapis.com/css?family=Roboto+Mono:400,400i,500,700&display=swap&subset=cyrillic,cyrillic-ext,greek,greek-ext,latin-ext"); */
@import url("https://cdn.jsdelivr.net/npm/@fontsource/roboto-mono@4.4.5/400.css");
@import url("https://cdn.jsdelivr.net/npm/@fontsource/roboto-mono@4.4.5/400-italic.css");
@import url("https://cdn.jsdelivr.net/npm/@fontsource/roboto-mono@4.4.5/500.css");
@import url("https://cdn.jsdelivr.net/npm/@fontsource/roboto-mono@4.4.5/700.css");

/* @import url("https://fonts.googleapis.com/css?family=Alegreya+Sans:400,400i,500,500i,700,700i&display=swap&subset=cyrillic,cyrillic-ext,greek,greek-ext,latin-ext,vietnamese"); */
/* @import url("https://cdn.jsdelivr.net/npm/@fontsource/alegreya-sans@5.0.12/400.css");
@import url("https://cdn.jsdelivr.net/npm/@fontsource/alegreya-sans@5.0.12/500.css");
@import url("https://cdn.jsdelivr.net/npm/@fontsource/alegreya-sans@5.0.12/700.css");
@import url("https://cdn.jsdelivr.net/npm/@fontsource/alegreya-sans@5.0.12/400-italic.css");
@import url("https://cdn.jsdelivr.net/npm/@fontsource/alegreya-sans@5.0.12/500-italic.css");
@import url("https://cdn.jsdelivr.net/npm/@fontsource/alegreya-sans@5.0.12/700-italic.css"); */
@import url("./fonts/alegreya.css");

@import url("./fonts/juliamono.css");
@import url("./fonts/vollkorn.css");
/* @import url("https://fonts.googleapis.com/css2?family=Lato&display=swap"); */
@import url("https://cdn.jsdelivr.net/npm/@fontsource/lato@4.4.5/400.css");
@import url("https://cdn.jsdelivr.net/npm/@fontsource/lato@4.4.5/400-italic.css");

@import url("./themes/light.css");
@import url("./themes/dark.css");
@import url("./ansi-colors.css");

@import url("./featured-card.css");

@import url("./hide-ui.css");

/* VARIABLES */

:root {
    --pluto-cell-spacing: 17px;
    /* use the value "contextual" to enable contextual ligatures `document.documentElement.style.setProperty('--pluto-operator-ligatures', 'contextual');`
        for julia mono see here: https://cormullion.github.io/pages/2020-07-26-JuliaMono/#contextual_and_stylistic_alternates_and_ligatures */
    --pluto-operator-ligatures: none;
    --julia-mono-font-stack: JuliaMono, Menlo, "Roboto Mono", "Lucida Sans Typewriter", "Source Code Pro", monospace;
    --sans-serif-font-stack: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
    --lato-ui-font-stack: "Lato", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Cantarell, "Apple Color Emoji", "Segoe UI Emoji",
        "Segoe UI Symbol", system-ui, sans-serif;
    --roboto-mono-font-stack: "Roboto Mono", "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", monospace;
    --system-ui-font-stack: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Cantarell, "Apple Color Emoji", "Segoe UI Emoji",
        "Segoe UI Symbol", system-ui, sans-serif;
    color-scheme: light dark;
}

/* GENERAL PAGE LAYOUT */
html {
    font-size: 16px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0px;
    overflow-anchor: none;
    overflow-x: hidden;
    position: relative;
    min-height: 100vh;
    background-color: var(--main-bg-color);
}

pluto-editor {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 0;
    container-type: inline-size;
    container-name: editor;
}

main {
    flex: 1;
    max-width: calc(700px + 25px + 6px); /* 700px + both paddings */
    padding-top: 0px;
    padding-bottom: 4rem;
    padding-left: 25px;
    padding-right: 6px;
    width: 100%;
}

pluto-editor:not(.disable_ui) > main {
    padding-bottom: 16rem;
}

body:has(pluto-editor:not(.disable_ui)) {
    overscroll-behavior: contain;
}

/* | main=25px+700px+6px=731px | pluto-helpbox=350px - 500px | */
/* min-width: 731px+ */

pluto-editor main {
    align-self: flex-end;
    margin-right: max(
        /* First part: center it */ max(0px, (100% - (700px + 25px + 6px)) / 2),
        /* Second part: push away from the right to take up all free space */ min((100% - (700px + 25px + 6px)), /* but don't do this more than */ 500px)
    );
    position: relative;
}

pluto-notebook {
    display: block;
    background: var(--main-bg-color);
}

/* STANDARD HTML ELEMENTS */

/* (can be overriden by custom style) */

pluto-output {
    font-family: "Alegreya Sans", "Trebuchet MS", sans-serif;
    font-size: 14.5px;
    font-weight: 400;
    color: var(--pluto-output-color);
}

pluto-output h1,
pluto-output h2,
pluto-output h3,
pluto-output h4,
pluto-output h5,
pluto-output h6 {
    font-family: "Vollkorn", Palatino, Georgia, serif;
    font-feature-settings: "lnum", "pnum";
    font-weight: 600;
    color: var(--pluto-output-h-color);
    margin-block-start: 1rem;
    margin-block-end: 0rem;
    line-height: 1.25em;
}

pluto-output h1,
pluto-output h2 {
    font-weight: 700;
    margin-block-start: 2rem;
}

pluto-output h1:first-child,
pluto-output h2:first-child {
    margin-block-start: calc(2rem - var(--pluto-cell-spacing));
}

pluto-output h1 {
    font-size: 2.2rem;
    border-bottom: 3px solid var(--rule-color);
    margin-bottom: 0.5rem;
}

pluto-output h2 {
    font-size: 1.8rem;
    border-bottom: 2px dotted var(--rule-color);
    margin-bottom: 0.5rem;
}

pluto-output h1:empty,
pluto-output h2:empty {
    border-bottom: none;
}

pluto-output h3 {
    font-size: 1.6rem;
    /* border-bottom: 2px dotted rgba(0,0,0,.15); */
}

pluto-output h4 {
    font-size: 1.4rem;
}

pluto-output h5 {
    font-size: 1.2rem;
}

pluto-output h6 {
    font-size: 1rem;
}

pluto-output h3:first-child,
pluto-output h4:first-child,
pluto-output h5:first-child,
pluto-output h6:first-child {
    margin-block-start: 0px;
}

pluto-output br,
pluto-output p {
    margin-block-start: 0px;
    margin-block-end: var(--pluto-cell-spacing);
    word-spacing: 0.053em;
    line-height: 1.6em;
}

/* This allows a linebreak in Markdown using backslash with smaller spacing compared to paragraph in firefox */
pluto-output br {
    margin-block-end: 0;
}

pluto-output p:first-child {
    margin-block-start: 0px;
}

/* https://github.com/necolas/normalize.css/blob/fc091cce1534909334c1911709a39c22d406977b/normalize.css#L96 */
b,
strong {
    font-weight: bolder;
}

/* I actually just want to get rid of the margin-block-start on the p tag,
    but css doesn't allow that. So I have to move the list up, instead of not moving it up */
pluto-output li p + ul,
pluto-output li p + ol {
    margin-block-start: calc(var(--pluto-cell-spacing) * -1);
}
pluto-output p:last-child {
    margin-block-end: 0px;
}

pluto-output img,
pluto-output video {
    max-width: 100%;
}

a {
    color: var(--black);
    /* font-weight: bold; */
    text-decoration-thickness: 2px;
    text-decoration-color: var(--a-underline);
    /* text-shadow: 1px -1px 0px #ffffff33; */
}
a:hover {
    text-decoration-color: var(--black);
}

.cm-cursor {
    border-left: 1.2px solid var(--cursor-color) !important;
}

pluto-output code {
    font-family: var(--julia-mono-font-stack);
    font-size: 0.9em; /* not rem */
    font-variant-ligatures: none;
}

pluto-output code .cm-editor .cm-line {
    font-family: var(--julia-mono-font-stack);
}

pluto-output pre > code {
    font-size: inherit;
}

pluto-output.rich_output code {
    padding: 0.18em;
    border-radius: 8px;
    background-color: var(--pluto-output-bg-color);
}
pluto-output.rich_output pre > code {
    padding: 0px;
    background-color: transparent;
    border-radius: 0;
}

pluto-log-dot pre,
pluto-output pre {
    display: inline-block;
    margin: 0px;
    white-space: pre-wrap;
    word-break: break-all;
    tab-size: 4;
    -moz-tab-size: 4; /* https://bugzilla.mozilla.org/show_bug.cgi?id=737785 */
    font-family: var(--julia-mono-font-stack);
    font-size: 0.8rem;
    font-variant-ligatures: none;
}

pluto-display pre {
    white-space: pre;
    word-break: normal;
}

pluto-output hr {
    border: none;
    border-top: 3px solid var(--rule-color);
    margin-left: 0;
    margin-right: 0;
}

pluto-output blockquote {
    margin-left: 1rem;
    margin-right: 1rem;
}

pluto-output.rich_output pre:not(.no-block),
pluto-output blockquote {
    margin-block-start: 0px;
    margin-block-end: var(--pluto-cell-spacing);
    display: block;
    padding: 15px;
    border-radius: 15px;
    background-color: var(--blockquote-bg);
    color: var(--blockquote-color);
}
pluto-output.rich_output pre:not(.no-block):last-child,
pluto-output blockquote:last-child {
    margin-block-end: 0px;
}

pluto-output div.admonition {
    border-radius: 8px;
    margin-block-start: 1em;
    margin-block-end: 1em;
}
pluto-output div.admonition .admonition-title {
    font-family: "Vollkorn", Palatino, sans-serif;
    font-feature-settings: "lnum", "pnum";
    color: var(--admonition-title-color);
    font-weight: 600;
    margin-block-end: 0px;
    padding-left: 0.3em;
    font-size: 1.3em;
}
pluto-output div.admonition .admonition-title ~ * {
    margin-block-end: 0.5em;
    margin-block-start: 0.5em;
    transition: filter linear 0.1s;
}

pluto-output div.admonition {
    padding-left: 0.5rem;
    padding-right: 0.5rem;
    background: var(--jl-message-color);
    border: 5px solid var(--jl-message-accent-color);
}
pluto-output div.admonition .admonition-title {
    background: var(--jl-message-accent-color);
    margin: -1px; /* Fixes a rendering glitch in Chrome */
    margin-left: -0.55rem;
    margin-right: -0.55rem;
}
pluto-output div.admonition.note,
pluto-output div.admonition.info,
pluto-output div.admonition.hint {
    background: var(--jl-info-color);
    border: 5px solid var(--jl-info-accent-color);
}
pluto-output div.admonition.note > .admonition-title,
pluto-output div.admonition.info > .admonition-title,
pluto-output div.admonition.hint > .admonition-title {
    background: var(--jl-info-accent-color);
}
pluto-output div.admonition.warning,
pluto-output div.admonition.alert-danger {
    background: var(--jl-warn-color);
    border: 5px solid var(--jl-warn-accent-color);
}
pluto-output div.admonition.warning > .admonition-title,
pluto-output div.admonition.alert-danger > .admonition-title {
    background: var(--jl-warn-accent-color);
}
pluto-output div.admonition.danger {
    background: var(--jl-danger-color);
    border: 5px solid var(--jl-danger-accent-color);
}
pluto-output div.admonition.danger > .admonition-title {
    background: var(--jl-danger-accent-color);
}

pluto-output div.admonition.hint > .admonition-title ~ * {
    filter: blur(0.25em);
}
pluto-output div.admonition.hint:hover > .admonition-title ~ *,
pluto-output div.admonition.hint:focus-within > .admonition-title ~ * {
    filter: blur(0em);
}

pluto-output div.footnote {
    margin-block-start: 1em;
    margin-block-end: 1em;
}

pluto-output div.footnote p.footnote-title::before {
    content: "[";
}
pluto-output div.footnote p.footnote-title::after {
    content: "]: ";
}
pluto-output a.footnote,
pluto-output div.footnote p.footnote-title {
    font-family: var(--roboto-mono-font-stack);
    font-size: 0.75rem;
    font-weight: 700;
    margin-block-end: 0px;
    letter-spacing: -0.05em;
    /* font-variant: small-caps; */
}

pluto-output div.footnote p.footnote-title ~ * {
    margin-left: 0.1em;
    padding-left: 0.4em;
    border-left: 5px solid var(--footnote-border-color);
    padding-bottom: var(--pluto-cell-spacing);
    margin-block-end: 0px;
}
pluto-output div.footnote p:last-child {
    padding-bottom: 0px;
}

pluto-output.scroll_y {
    max-height: 80vh;
    max-height: 502px;
    overflow: auto;
}

pluto-output table {
    border-collapse: collapse;
    border: 2px solid var(--table-border-color);
    border-left: none;
    border-right: none;
    margin: 0 auto;
    margin-block-start: var(--pluto-cell-spacing);
    margin-block-end: var(--pluto-cell-spacing);
}

pluto-output table > thead {
    border-bottom: 1px solid var(--table-border-color);
}

pluto-output table > tbody td {
    font-family: var(--julia-mono-font-stack);
    font-size: 0.75rem;
    font-variant-ligatures: none;
}
pluto-output table > tbody td code {
    font-size: 0.75rem;
}

pluto-output table td,
pluto-output table th {
    padding: 0.2rem 0.5rem;
}

pluto-output table > tbody tr:hover {
    background-color: var(--table-bg-hover-color);
}
pluto-output table pre {
    white-space: pre;
}

pluto-output kbd,
kbd {
    letter-spacing: -0.7px;
    border: 1px solid var(--kbd-border-color);
    border-radius: 3px;
    padding: 0.1em 0.4em;
    font-family: var(--julia-mono-font-stack);
    font-size: 0.9rem;
    font-weight: 600;
}

/* Avoid scrollbar in in-line latex with markdown, see https://github.com/fonsp/Pluto.jl/issues/1309 */
pluto-output mjx-assistive-mml {
    height: 1px;
}

/* Allow horizontal scrolling of wide markdown content (e.g. long MathJax
   expressions) while keeping vertical overflow hidden. This still prevents
   scrollbars for simple headers but avoids clipping.  */
.raw-html-wrapper > div.markdown {
    overflow-x: auto;
    overflow-y: hidden;
}

pluto-output details {
    border: 1px solid var(--rule-color);
    border-radius: 4px;
    padding: 0.5em 0.5em 0;
    margin-block-start: 0;
    margin-block-end: var(--pluto-cell-spacing);
}

pluto-output details:first-child {
    margin-block-start: 0;
}

pluto-output details:last-child {
    margin-block-end: 0;
}

pluto-output details summary {
    cursor: pointer;
    font-family: var(--system-ui-font-stack);
    font-weight: bold;
    border-radius: 3px;
    padding: 0.5em;
    margin: -0.5em -0.5em 0;
    transition: color 0.25s ease-in-out, background-color 0.25s ease-in-out;
    /* Border may have transparency, let's not change the border with a background-color */
    background-clip: padding-box;
}

pluto-output details summary:hover {
    color: var(--blockquote-color);
    background-color: var(--blockquote-bg);
}

pluto-output details[open] {
    padding: 0.5em;
}

pluto-output details[open] summary {
    border-bottom: 1px solid var(--rule-color);
    border-bottom-right-radius: 0;
    border-bottom-left-radius: 0;
    margin-bottom: 0.5em;
}

/* HEADER */

header#pluto-nav {
    /* position: absolute;
    top: 0px; */
    width: 100%;
    min-height: 60px;
    z-index: 60;
    background-color: var(--header-bg-color);
    transform: translateY(0px);
    transition: background-color 0.5s ease-in-out, transform 0.25s cubic-bezier(0.18, 0.89, 0.49, 1.13);
    border-bottom: solid 1px var(--header-border-color);
    font-family: var(--roboto-mono-font-stack);
    font-weight: 400;
    font-size: 0.8rem;
}

header#pluto-nav.show_export {
    --header-height: 9.3rem;
    position: sticky;
    top: 0;
    transform: translateY(var(--header-height));
}

dialog#export {
    position: absolute;
    display: block;
    top: 0;
    width: 100%;
    height: var(--header-height);
    background: var(--export-bg-color);
    color: var(--export-color);
    transform: translateY(calc(-100% - 1px));
    /* overlay: none !important; */
    overflow: visible;
    margin: 0;
    padding: 0;
    max-width: none;
    max-height: none;
    border: none;
}
dialog#export::before {
    content: "";
    position: absolute;
    bottom: 100%;
    left: 0;
    right: 0;
    height: 100px;
    background: inherit;
}
dialog.pride#export {
    background: linear-gradient(
        80deg,
        hsl(0deg 43.55% 26.63%),
        hsl(30deg 50.05% 37.86%),
        hsl(55deg 49.41% 34.19%),
        hsl(140deg 12.48% 45.98%),
        hsl(220deg 35.66% 38.34%),
        hsl(280deg 30.8% 32.11%)
    );
}
dialog#export::after {
    transform: translateY(2px);
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    height: 2px;
    width: 100%;
    pointer-events: none;
    background: var(--header-bg-color);
}
dialog.pride#export::after {
    --c1: hsl(51.39deg 89.27% 68.71%);
    --c2: hsl(281.12deg 68.59% 80.75%);
    --c3: var(--c1);
    --c4: hsl(0deg 0% 84.61%);
    --c5: hsl(334.67deg 58.4% 75.81%);
    --c6: hsl(204.67deg 41.19% 68.46%);
    --c7: hsl(41deg 70.19% 37.26%);
    --c8: hsl(0deg 0% 26.02%);
    background: repeating-linear-gradient(
        to right,
        var(--c1) 0%,
        var(--c1) 12.5%,
        var(--c2) 12.5%,
        var(--c2) 25%,
        var(--c3) 25%,
        var(--c3) 37.5%,
        var(--c4) 37.5%,
        var(--c4) 50%,
        var(--c5) 50%,
        var(--c5) 62.5%,
        var(--c6) 62.5%,
        var(--c6) 75%,
        var(--c7) 75%,
        /* black */ var(--c7) 87.5%,
        var(--c8) 87.5%,
        /* white */ var(--c8) 100%
    );
}
dialog#export div#container {
    flex-direction: row;
    display: flex;
    max-width: 1000px;
    padding-right: 10em;
    margin: 0 auto;
    position: relative;
    height: var(--header-height);
}
header dialog#export div#container {
    /* to prevent the div from taking up horizontal page when the export pane is closed. On small screen this causes overscroll on the right. */
    overflow-x: hidden;
}
header.show_export dialog#export div#container {
    overflow-x: auto;
}
a.export_card {
    margin: 20px 5px;
    flex: 0 0 auto;
    width: var(--size, 24ch);
    border: 5px solid transparent;
    background: var(--export-card-bg-color);
    border-radius: 8px;
    color: var(--export-card-title-color);
    box-shadow: 0px 2px 10px var(--export-card-shadow-color);
    text-decoration: none;
    overflow: hidden;
}
div.export_title {
    align-self: center;
    flex: 0 0 auto;
    border-radius: 8px;
    text-orientation: sideways-right;
    /* Not supported by Chrome: */
    /* writing-mode: sideways-lr; */
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    font-weight: 700;
    font-size: 1rem;
    max-width: var(--header-height);
    padding-inline: 0.5em;
    text-align: center;
}
a.export_card header {
    margin-block: 0px;
    font-family: "Vollkorn", Palatino, sans-serif;
    /* font-family: system-ui; */
    font-feature-settings: "lnum", "pnum";
    font-size: 17px;
}
a.export_card section {
    color: var(--export-card-text-color);
    font-weight: 500;
    /* font-family: system-ui; */
    /* font-size: 14px; */
    padding: 3px;
    text-overflow: ellipsis;
    overflow: hidden;
}
dialog#export .export_small_btns {
    display: flex;
    flex-direction: row;
    padding: 0.9em;
    border-radius: 0.9em;
    position: absolute;
    right: 0.8em;
    top: 0em;
    background: var(--export-bg-color);
}
dialog#export .pride_message {
    flex: 1 0 auto;
    align-self: center;
    margin-left: 32ch;
}
dialog#export .pride_message p {
    margin: 0;
    padding: 0.2ch 1ch;
    background: black;
    transform: rotate(3deg);
}
pluto-editor.static_preview button.toggle_export {
    display: none;
}

.ionicon-icon {
    display: inline-block;
    width: 1em;
    height: 1em;
    /* background-image: url("https://cdn.jsdelivr.net/gh/ionic-team/ionicons@5.5.1/src/svg/notifications-outline.svg"); */
    background-size: contain;
    filter: var(--image-filters);
    vertical-align: -0.1em;
}

.ionicon-icon-margin {
    margin-inline-start: 0.4ch;
}

/* You need to add all icon links */
.ionicon-icon[data-icon="download-outline"] {
    background-image: url("https://cdn.jsdelivr.net/gh/ionic-team/ionicons@5.5.1/src/svg/download-outline.svg");
}
.ionicon-icon[data-icon="cloud-upload-outline"] {
    background-image: url("https://cdn.jsdelivr.net/gh/ionic-team/ionicons@5.5.1/src/svg/cloud-upload-outline.svg");
}
.ionicon-icon[data-icon="trash-bin-outline"] {
    background-image: url("https://cdn.jsdelivr.net/gh/ionic-team/ionicons@5.5.1/src/svg/trash-bin-outline.svg");
}
.ionicon-icon[data-icon="arrow-up-circle-outline"] {
    background-image: url("https://cdn.jsdelivr.net/gh/ionic-team/ionicons@5.5.1/src/svg/arrow-up-circle-outline.svg");
}
.ionicon-icon[data-icon="document-text-outline"] {
    background-image: url("https://cdn.jsdelivr.net/gh/ionic-team/ionicons@5.5.1/src/svg/document-text-outline.svg");
}
.ionicon-icon[data-icon="open-outline"] {
    background-image: url("https://cdn.jsdelivr.net/gh/ionic-team/ionicons@5.5.1/src/svg/open-outline.svg");
}
.ionicon-icon[data-icon="help-circle-outline"] {
    background-image: url("https://cdn.jsdelivr.net/gh/ionic-team/ionicons@5.5.1/src/svg/help-circle-outline.svg");
}
.ionicon-icon[data-icon="build-outline"] {
    background-image: url("https://cdn.jsdelivr.net/gh/ionic-team/ionicons@5.5.1/src/svg/build-outline.svg");
}

dialog.export-html-dialog {
    max-width: 22rem;
    border-radius: 0.6rem;
    border: none;
    background: var(--main-bg-color);
    box-shadow: 0px 2px 30px #0000005c;
    padding: 0;
    font-family: var(--system-ui-font-stack);
}

dialog.export-html-dialog > div.ple-option {
    padding: 1.4em 1.4em;
}

dialog.export-html-dialog > div.ple-or {
    height: 0;
    padding: 0 1.4em;
    text-align: center;
    font-weight: 700;
    color: var(--pluto-output-color);
    line-height: 0;
    transform: translateY(-1px);
}

dialog.export-html-dialog > div.ple-or span {
    background: var(--plutoland-or-bg-color);
    padding: 0.2em 0.5em;
    border-radius: 0.4em;
}

dialog.export-html-dialog > div {
    padding: 1em;
}

dialog.export-html-dialog a {
    color: inherit;
    text-decoration-color: currentcolor;
}

dialog.export-html-dialog p {
    margin: 0;
}

dialog.export-html-dialog > .ple-download > p {
    color: var(--pluto-output-color);
}

dialog.export-html-dialog .ple-bigbutton-container {
    display: grid;
    place-items: center;
    padding: 2em 0.5em 1em 0.5em;
}

dialog.export-html-dialog :is(.ple-bigbutton, .ple-plutoland-phase) {
    display: block;
    padding: 0.8em 1.2em;
    border: none;
    border-radius: 0.4em;
    background: var(--plutoland-bigbutton-bg-color);
    box-shadow: 0px 1px 10px #00000033;
    text-decoration: none;
    text-align: center;
    color: var(--black);
}

dialog.export-html-dialog a.ple-plutoland-url {
    font-family: monospace, sans-serif;
    font-size: 0.7em;
    font-weight: 700;
    text-overflow: clip;
    overflow: hidden;
    white-space: nowrap;
    background: var(--plutoland-url-bg);
    color: var(--plutoland-url-fg);
    padding: 0.2em 0.4em;
    border-radius: 0.3em;
    display: inline-block;
}

dialog.export-html-dialog .ple-plutoland-url-container {
    margin-top: 1em;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.5em;
}

dialog.export-html-dialog > div.ple-plutoland {
    background: #3c4c59;
    color: white;
    box-shadow: inset 0px 0px 47px #00000030;
}

dialog.export-html-dialog > div.final button {
    cursor: pointer;
}

nav#at_the_top h1 {
    color: var(--nav-h1-text-color);
    letter-spacing: 2px;
}

nav#at_the_top {
    margin: 0 auto;
    max-width: 1000px;
    padding-left: 20px;
    padding-right: 20px;
    flex-wrap: wrap;
    min-height: 60px;
    display: flex;
    flex-direction: row;
    z-index: 100;
}

nav#at_the_top > * {
    flex: 0 0 auto;
    align-self: center;
    margin: 10px 0px;
}

nav#at_the_top > .flex_grow_1 {
    flex-grow: 1;
}
nav#at_the_top > .flex_grow_2 {
    flex-grow: 2;
}

nav#at_the_top > a {
    /* margin-right: 5rem; */
}

nav#at_the_top h1 {
    font-weight: 700;
    font-size: 1.8rem;
    display: inline;
    border-bottom: none;
}

nav#at_the_top img#logo-small,
nav#at_the_top img#logo-big {
    height: 39px;
    margin-bottom: -8px;
    filter: var(--image-filters);
}

nav#at_the_top img#logo-small {
    display: none;
}

@media (max-width: 800px) {
    nav#at_the_top img#logo-small {
        display: unset;
    }
    nav#at_the_top img#logo-big {
        display: none;
    }
    nav#at_the_top > a {
        /* margin-right: 1rem; */
    }
}

nav#at_the_top > pluto-filepicker,
nav#at_the_top > div.desktop_picker {
    width: 210px;
    flex-grow: 1;
    display: flex;
    flex-direction: row;
}

nav#at_the_top > pluto-filepicker .cm-editor,
nav#at_the_top > div.desktop_picker span {
    height: calc(1rem + 4px + 4px + 4px);
    display: inline-block;
    min-width: 10rem;
    font-style: normal;
    font-weight: 500;
    font-family: inherit;
    font-size: 0.8rem;
    letter-spacing: 1px;
    background: none;
    color: var(--nav-filepicker-color);
    border: 2px solid var(--footer-input-border-color);
    border-radius: 3px;
    border-right: none;
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

pluto-filepicker .cm-scroller {
    scrollbar-width: none; /* Firefox */
}
pluto-filepicker .cm-scroller::-webkit-scrollbar {
    display: none; /* Safari and Chrome */
}

pluto-filepicker button,
div.desktop_picker button {
    cursor: pointer;
    height: auto;
}

pluto-filepicker button:disabled {
    cursor: not-allowed;
}

header#pluto-nav pluto-filepicker button {
    margin: 0px;
    background: var(--footer-filepicker-focus-color);
    border-radius: 0 3px 3px 0;
    border: 3px solid var(--footer-filepicker-focus-color);
    color: var(--footer-filepicker-button-color);
    /* border: none; */
    font-family: inherit;
    font-weight: 600;
    height: auto;
    font-size: 0.75rem;
}

pluto-filepicker.suggest_button button {
    outline: 4px solid var(--nav-filepicker-suggest-color);
    animation: pulse-outline 3s ease-in-out infinite;
}

@media (prefers-reduced-motion) {
    pluto-filepicker.suggest_button button {
        animation: none;
    }
}

@keyframes pulse-outline {
    0%,
    50% {
        outline-offset: 0px;
    }
    25% {
        outline-offset: 4px;
    }
}

/* .desktop_picker button {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
} */

div.desktop_picker span {
    white-space: nowrap;
    overflow-x: hidden;
    text-overflow: ellipsis;
    vertical-align: middle;
    padding: 0 5px;
    line-height: 1.8;
    cursor: pointer;
}

button.start_stop_recording,
button.toggle_export,
.export_small_btns button {
    border: none;
    background: none;
    cursor: pointer;
    opacity: 0.5;
}
button.start_stop_recording span,
button.toggle_export span,
.export_small_btns button span {
    display: block;
    content: " " !important;
    background-size: 25px 25px;
    height: 25px;
    width: 25px;
}

nav#at_the_top button.start_stop_recording span {
    background-image: url("https://cdn.jsdelivr.net/gh/ionic-team/ionicons@5.5.1/src/svg/radio-button-on-outline.svg");
}
nav#at_the_top button.start_stop_recording.stop span {
    background-image: url("https://cdn.jsdelivr.net/gh/ionic-team/ionicons@5.5.1/src/svg/stop-circle-outline.svg");
}
nav#at_the_top button.toggle_export span {
    background-image: url("https://cdn.jsdelivr.net/gh/ionic-team/ionicons@5.5.1/src/svg/share-outline.svg");
    filter: var(--image-filters);
}
dialog#export button.toggle_export span {
    background-image: url("https://cdn.jsdelivr.net/gh/ionic-team/ionicons@5.5.1/src/svg/close-outline.svg");
    filter: invert(1);
}
dialog#export button.toggle_frontmatter_edit span {
    background-image: url("https://cdn.jsdelivr.net/gh/ionic-team/ionicons@5.5.1/src/svg/newspaper-outline.svg");
    filter: invert(1);
}
dialog#export button.toggle_presentation span {
    background-image: url("https://cdn.jsdelivr.net/gh/ionic-team/ionicons@5.5.1/src/svg/easel-outline.svg");
    filter: invert(1);
}
nav#at_the_top:after {
    margin-left: auto;
    align-self: center;
}

.cm-tooltip-autocomplete li.file.new:before {
    content: "👉";
    color: black;
}

.cm-tooltip-autocomplete li.file:before {
    content: "📄";
    color: black;
}

.cm-tooltip-autocomplete li.dir:before {
    content: "📁";
    color: black;
}

@media (any-pointer: fine) {
    nav#at_the_top > pluto-filepicker .cm-editor,
    nav#at_the_top > div.desktop_picker span {
        border: 2px solid transparent;
        border-right: none;
        transition: border 0.15s ease-in-out;
    }
    nav#at_the_top > pluto-filepicker button,
    nav#at_the_top > div.desktop_picker button {
        opacity: 0;
        transition: opacity 0.15s ease-in-out;
    }
    header:hover > nav#at_the_top > pluto-filepicker .cm-editor,
    header:focus-within > nav#at_the_top > pluto-filepicker .cm-editor,
    header:hover > nav#at_the_top > div.desktop_picker span,
    header:focus-within > nav#at_the_top > div.desktop_picker span {
        border: 2px solid var(--footer-input-border-color);
        border-right: none;
    }
    header:hover > nav#at_the_top > pluto-filepicker button,
    header:focus-within > nav#at_the_top > pluto-filepicker button,
    header:hover > nav#at_the_top > div.desktop_picker button,
    header:focus-within > nav#at_the_top > div.desktop_picker button {
        opacity: 1;
    }
}

pluto-editor.binder > header#pluto-nav > nav#at_the_top > pluto-filepicker > * {
    display: none;
}
pluto-editor.binder > header#pluto-nav > nav#at_the_top > pluto-filepicker > a {
    display: block;
    font-size: 16px;
    font-family: var(--julia-mono-font-stack);
    opacity: 0.8;
    text-decoration: none;
}

pluto-editor.nbpkg_restart_recommended > header#pluto-nav,
pluto-editor.nbpkg_restart_required > header#pluto-nav,
pluto-editor.binder.loading > header#pluto-nav,
pluto-editor.process_waiting_for_permission > header#pluto-nav,
pluto-editor.process_dead > header#pluto-nav,
pluto-editor.disconnected > header#pluto-nav {
    position: sticky;
    top: 0;
    backdrop-filter: blur(10px);
}

pluto-editor.nbpkg_restart_recommended > header#pluto-nav {
    background-color: var(--restart-recc-header-color);
}
pluto-editor.nbpkg_restart_required > header#pluto-nav {
    background-color: var(--restart-req-header-color);
}
pluto-editor.process_dead > header#pluto-nav {
    background-color: var(--dead-process-header-color);
}
pluto-editor.process_waiting_for_permission > header#pluto-nav {
    background-color: var(--restart-recc-header-color);
}
pluto-editor.loading > header#pluto-nav {
    background-color: var(--loading-header-color);
}
pluto-editor.disconnected > header#pluto-nav {
    background-color: var(--disconnected-header-color);
}
pluto-editor.binder.loading > header#pluto-nav {
    background-color: var(--binder-loading-header-color);
}

nav#at_the_top > #process_status {
    font-size: 1rem;
    font-weight: 500;
    padding: 5px 10px;
    margin: 5px;
    background: var(--nav-process-status-bg-color);
    color: var(--nav-process-status-color);
    border-radius: 10px;
    z-index: 10;
    margin-left: 1em;
}

nav#at_the_top > #process_status:empty {
    display: none;
}

pluto-editor.fullscreen .statefile-fetch-progress {
    /* width: 200px;
    height: 27px;
    background: white;
    border: 5px solid #d1d9e4;
    border-radius: 6px; */
    --w: min(80vw, 300px);
    position: absolute;
    left: calc(50% - 0.5 * var(--w));
    top: 0;
    z-index: 300000;
    /* box-sizing: content-box; */
    /* height: 2rem; */
    width: var(--w);
}

loading-bar {
    height: 6px;
    width: 10vw;
    /* background-color: #b1c9dd; */
    background: linear-gradient(90deg, var(--loading-grad-color-1), var(--loading-grad-color-2), var(--loading-grad-color-1));
    background-size: 100vw 100%;
    position: fixed;
    top: 0px;
    left: 0px;
    display: block;
    transition: width cubic-bezier(0.14, 0.71, 0, 0.99) 2s, opacity linear 0.2s;
    opacity: 0;
    z-index: 12000;
    animation: move-background 2s ease-in-out infinite;
}
loading-bar.slow {
    transition: width cubic-bezier(0.14, 0.71, 0, 0.99) 10s, opacity linear 0.5s;
}
@media (prefers-reduced-motion) {
    loading-bar {
        transition: none;
    }
}

pluto-editor.binder.loading #binder_spinners {
    opacity: 0.25;
}

@keyframes move-background {
    0% {
        background-position-x: 0vw;
    }
    100% {
        background-position-x: 100vw;
    }
}

.outline-frame {
    z-index: 1500;
    pointer-events: none;
    position: fixed;
    top: 0px;
    left: 0px;
    width: 100vw;
    height: 100vh;
    /* outline: red inset 15px; */
    box-sizing: border-box;
}

pluto-editor.process_waiting_for_permission > .outline-frame.safe-preview {
    border-bottom: 12px solid var(--restart-recc-header-color);
}

pluto-editor.recording_waiting_to_start > .outline-frame.recording {
    border: 12px solid #be6f6fba;
}
pluto-editor.is_recording > .outline-frame.recording {
    border: 12px solid #645e5eba;
}
.outline-frame.playback {
    opacity: 1;
    position: absolute;
    transition: top 0.3s ease-in-out, opacity 0.3s ease-in-out;
    border: 12px solid #357ddcba;
    /* background: #7b77ff12; */
    box-shadow: inset 0px 0px 20px 20px #919bff2b;
}

pluto-editor.recording_waiting_to_start > header#pluto-nav,
pluto-editor.is_recording > header#pluto-nav {
    display: none;
}

.outline-frame-actions-container {
    position: fixed;
    top: 3px;
    z-index: 2010;
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
}

.outline-frame-actions-container.safe-preview {
    top: auto;
    bottom: 4px;
}

.outline-frame-actions-container > .overlay-button {
    /* background: pink; */
    border-color: #e86f6c;
    margin: 0 3px;
}
.outline-frame-actions-container > .overlay-button.record-no-audio {
    border-color: #dcc6c6;
}
.outline-frame-actions-container > .overlay-button.playback {
    border-color: #c6c6dc;
}
span.pluto-icon.stop-recording-icon::after {
    background-image: url("https://cdn.jsdelivr.net/gh/ionic-team/ionicons@5.5.1/src/svg/stop-circle-outline.svg");
}
span.pluto-icon.microphone-icon::after {
    background-image: url("https://cdn.jsdelivr.net/gh/ionic-team/ionicons@5.5.1/src/svg/mic-outline.svg");
}
span.pluto-icon.info-icon::after {
    background-image: url("https://cdn.jsdelivr.net/gh/ionic-team/ionicons@5.5.1/src/svg/information-circle-outline.svg");
}
span.pluto-icon.offline-icon::after {
    background-image: url("https://cdn.jsdelivr.net/gh/ionic-team/ionicons@5.5.1/src/svg/cloud-offline-outline.svg");
}
span.pluto-icon.mute-icon::after {
    background-image: url("https://cdn.jsdelivr.net/gh/ionic-team/ionicons@5.5.1/src/svg/mic-off-outline.svg");
}
span.pluto-icon.follow-recording-icon::after {
    background-image: url("https://cdn.jsdelivr.net/gh/ionic-team/ionicons@5.5.1/src/svg/arrow-undo-outline.svg");
}

div.recording-playback {
    width: min(500px, 90vw);
    position: fixed;
    bottom: 16px;
    z-index: 2010;
}
div.recording-playback audio {
    width: 100%;
}

.safe-preview-info {
    color: var(--black);
    font-family: var(--system-ui-font-stack);
    font-weight: 700;
    background: var(--white);
    border: 3px solid var(--restart-recc-accent-color);
    padding: 0.3em 0.8em;
    border-radius: 0.8em;
}
.safe-preview-info > span {
    display: flex;
    /* flex-direction: row; */
}
.safe-preview-info button {
    background: none;
    border: none;
    cursor: pointer;
}

.safe-preview-output {
    color: var(--helpbox-header-color);
    font-family: var(--system-ui-font-stack);
    font-weight: 700;
    opacity: 0.5;
    font-size: 0.8rem;
    padding: 0.2em 0.4em;
    background: var(--restart-recc-header-color);
    border-radius: 0.4em;
    display: inline-flex;
    margin: 0.7em 0;
    gap: 0.3em;
    align-items: baseline;
}

/* PREAMBLE */

.raw-html-wrapper.preamble {
    width: 100%;
}

main > preamble {
    display: flex;
    height: 20px;
    position: sticky;
    top: 5px;
    margin-top: 5px;
    padding-right: 5px;
    z-index: 200;
    pointer-events: none;
}

.overlay-button {
    background: var(--overlay-button-bg);
    color: var(--overlay-button-color);
    padding: 5px 8px;
    border: 3px solid var(--overlay-button-border);
    border-radius: 12px;
    height: 35px;
    font-family: var(--roboto-mono-font-stack);
    font-size: 0.75rem;
    pointer-events: all;
    /* break-inside: avoid; */
    white-space: nowrap;
}
.overlay-button button:not(.asdfdsf) {
    color: var(--overlay-button-color);
}

main > preamble #saveall-container {
    margin-left: auto;
}
pluto-editor.fullscreen main > preamble #saveall-container {
    transform: translateX(max(0px, 100vw - 700px - 25px));
    /* position: relative; */
}

@media screen and (min-width: calc(700px + 25px + 6px + 500px)) {
    pluto-editor.fullscreen main > preamble #saveall-container {
        transform: translateX(500px);
    }
}

main > preamble #saveall-container.ask_to_save {
    border-color: var(--overlay-button-border-save);
}
main > preamble #saveall-container.saving,
main > preamble #saveall-container.saved {
    border-color: transparent;
}

main > preamble #saveall-container.saving > span,
main > preamble #saveall-container.saved > span {
    opacity: 0.5;
}

span.pluto-icon::after {
    content: "";
    display: inline-block;
    padding-right: 1.5em;
    height: 1.3em;
    margin-bottom: -0.3em;
    transform: translateY(-0.1em);
    background-size: 1.3em;
    background-image: url("https://cdn.jsdelivr.net/gh/ionic-team/ionicons@5.5.1/src/svg/sync-circle-outline.svg");
    background-repeat: no-repeat;
    background-position-x: right;
    background-position-y: 1px;
    filter: var(--image-filters);
}

main > preamble span.saved-icon::after,
.overlay-button span.saved-icon::after {
    background-image: url("https://cdn.jsdelivr.net/gh/ionic-team/ionicons@5.5.1/src/svg/checkmark-outline.svg");
    filter: var(--image-filters);
}

#saveall-container .only-on-hover {
    display: none;
}
#saveall-container:hover .only-on-hover {
    display: inline;
}

/* CELL */

pluto-cell {
    display: block;
    /* CodeMirror line height (defined by their JS somehow) + 1px border top + 1px border bottom */
    min-height: calc(23px + 1px + 1px);
    margin-top: var(--pluto-cell-spacing);
    position: relative;
}

pluto-output {
    display: block;
    padding-left: 10px;
    padding-right: 10px;
    align-items: baseline;
    overflow-x: auto;
    background-color: var(--pluto-output-bg-color);
}

.scroll_y {
    overflow-y: auto;
    max-height: 80vh;
}

pluto-output:focus {
    outline: none;
}

pluto-output:not(.rich_output) {
    display: flex;
    flex-wrap: wrap;
    padding-top: 3px;
    padding-bottom: 3px;
}

pluto-output > assignee {
    font-family: var(--julia-mono-font-stack);
    font-size: 0.75rem;
    font-variant-ligatures: none;
}

pluto-output > assignee::after {
    content: "\a0=\a0";
    opacity: 0.6;
}

pluto-output > assignee:empty {
    display: none;
}

.errored pluto-output > assignee {
    display: none;
}

pluto-output > div {
    flex-shrink: 0;
    overflow-y: hidden;
}

pluto-output div.raw-html-wrapper {
    display: contents;
}

pluto-output:not(.rich_output) > div > pre {
    display: flex;
}

.bonds_disabled:where(.offer_binder, .offer_local) bond {
    opacity: 0.6;
    filter: grayscale(1);
}

@keyframes fadeintext {
    from {
        color: transparent;
    }
    to {
        color: inherit;
    }
}

/* as embedded display: */

pluto-display {
    display: contents;
}
pluto-display > div {
    display: contents;
}

/* isolated cell view */
.isolated-cell > pluto-output {
    padding: 0;
}
.hidden-cell {
    display: none;
}

/* DISABLED CELLS */

pluto-cell.depends_on_disabled_cells > pluto-output,
pluto-cell.running_disabled > pluto-output,
pluto-cell.depends_on_disabled_cells > pluto-trafficlight,
pluto-cell.running_disabled > pluto-trafficlight,
pluto-cell.depends_on_disabled_cells > pluto-input .cm-editor,
pluto-cell.running_disabled > pluto-input .cm-editor,
pluto-cell.depends_on_disabled_cells > pluto-logs-container,
pluto-cell.running_disabled > pluto-logs-container {
    opacity: 0.3;
}

pluto-cell.running_disabled > pluto-input .cm-editor,
pluto-cell.running_disabled > pluto-output {
    background-color: var(--disabled-cell-bg-color);
}

/* SKIP AS SCRIPT CELLS */
pluto-cell.skip_as_script .skip_as_script_marker,
pluto-cell.depends_on_skipped_cells .depends_on_skipped_marker {
    display: block;
    position: absolute;
    top: 0;
    bottom: 0;
    cursor: help;
    z-index: 20;
    right: -3px;
    width: 4px;
    border-radius: 0px 4px 4px 0px;
    background-color: var(--skip-as-script-background-color);
}

pluto-cell.depends_on_skipped_cells .depends_on_skipped_marker {
    background-color: var(--depends-on-skip-as-script-background-color);
}

pluto-cell.skip_as_script pluto-input .cm-editor,
pluto-cell.depends_on_skipped_cells pluto-input .cm-editor {
    border-bottom-right-radius: 0px;
}

/* SELECTION */

pluto-cell.selected {
    background: var(--selected-cell-bg-color);
    border-radius: 0 3px 3px 0;
}

pluto-cell.selected > pluto-input > div.cm-editor,
pluto-cell.selected > pluto-output {
    opacity: 0.7;
}

main {
    cursor: vertical-text;
}
pluto-cell {
    cursor: auto;
}

/* SCROLLBAR FIREFOX */

pluto-output > div {
    scrollbar-width: thin;
    scrollbar-color: transparent transparent;
}

pluto-cell:hover > pluto-output > div {
    scrollbar-color: var(--hover-scrollbar-color-1) var(--hover-scrollbar-color-2);
}

/* SCROLLBAR CHROME */

pluto-output > div::-webkit-scrollbar {
    height: 6px;
    background: transparent;
}

pluto-output > div::-webkit-scrollbar-thumb {
    background: transparent;
}

pluto-cell:hover > pluto-output > div::-webkit-scrollbar {
    background: var(--hover-scrollbar-color-2);
}

pluto-cell:hover > pluto-output > div::-webkit-scrollbar-thumb {
    background: var(--hover-scrollbar-color-1);
}

/* CELL INPUT */

pluto-input .cm-editor {
    z-index: 20;
    border-bottom-right-radius: 4px;
    border: 1px solid var(--normal-cell-color);
    border-left: none;

    /* Make sure that scrolling an editor into view gives some breathing room */
    scroll-margin-block: 20vh;
    min-height: 25px;
}
pluto-input:focus-within .cm-editor {
    /* z-index increased by 1 to make sure that the autocomplete window shows above all other editors, see https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Positioning/Understanding_z_index/The_stacking_context */
    z-index: 21;
}

pluto-input .cm-editor .cm-line {
    transition: background-color 0.15s ease-in-out;
}

pluto-input .cm-editor span.cm-highlighted-range,
pluto-input .cm-editor .cm-line.cm-highlighted-line {
    background-color: var(--cm-highlighted);
    border-radius: 3px;
}

pluto-cell:not(.show_input) > pluto-input {
    display: none;
}
pluto-cell.code_folded.show_input > pluto-input:not(:focus-within) {
    opacity: 0.4;
}

pluto-cell.code_differs > pluto-input > .cm-editor {
    border: 1px solid var(--code-differs-cell-color);
    border-left: none;
}

/* UI */

button.floating_back_button,
.overlay-button button,
pluto-cell > button,
pluto-input > button,
pluto-runarea > button,
pluto-shoulder > button,
nav#slide_controls > button {
    position: absolute;
    margin: 0px;
    padding: 1px;
    opacity: 50%;
    border: none;
    background: none;
    cursor: pointer;
    /* color: hsl(204, 86%, 35%); */
    color: var(--ui-button-color);
    font-family: var(--roboto-mono-font-stack);
    font-size: 0.75rem;
    z-index: 30;
    /* CodeMirror is 2 */
}

.overlay-button button {
    position: relative;
}

/* CELL SHOULDER */

pluto-shoulder {
    position: absolute;
    /* top: 0px; */
    /* bottom: 0px; */
    --invisible-border: calc(0.5 * var(--pluto-cell-spacing));
    --shoulder-width: calc(28px + var(--invisible-border));
    --border-radius: calc(5px + var(--invisible-border));

    left: calc(0px - var(--shoulder-width));
    width: var(--shoulder-width);
    border-radius: var(--border-radius) 0px 0px var(--border-radius);
    cursor: move;
    display: flex;
    flex-direction: row;
    justify-content: flex-end;
    align-items: flex-start;
    /* Add an invisible border around the shoulder, to make it easier to click on. (The area between two cells is divided in two, each half belongs to the closest pluto-cell.) */
    top: calc(0px - var(--invisible-border));
    bottom: calc(0px - var(--invisible-border));
    border: var(--invisible-border) solid rgba(0, 0, 0, 0);
    border-right: none;
}
pluto-editor.fullscreen pluto-shoulder {
    --shoulder-width: 2000px;
}

pluto-editor:not(.disable_ui) pluto-shoulder:hover {
    /* pluto-shoulder:hover { */
    background: var(--shoulder-hover-bg-color);
    background-clip: padding-box;
}

pluto-shoulder > button {
    flex: 0 0 auto;
    position: sticky;
    top: 0;
    padding: 4px 5px 4px 10px;
}

pluto-cell:focus-within > pluto-shoulder > button {
    /* we use padding instead of 4px extra margin to move the eye to the left so that the hitbox becomes grows - you want to be able to double click the button */
    padding-right: 9px;
}

/* pluto-cell.code_folded.inline-output > pluto-shoulder > button {
    margin-top: 3px;
} */

pluto-shoulder > button > span::after {
    background-image: url("https://cdn.jsdelivr.net/gh/ionic-team/ionicons@5.5.1/src/svg/eye-outline.svg");
    filter: var(--image-filters);
}

pluto-cell.code_folded:not(.inspecting_hidden_code) > pluto-shoulder > button > span::after {
    background-image: url("https://cdn.jsdelivr.net/gh/ionic-team/ionicons@5.5.1/src/svg/eye-off-outline.svg");
    filter: var(--image-filters);
}

/* TRAFFIC LIGHT */

pluto-trafficlight {
    /* --patternHeight is derived from the pattern length (16px) div sin(45deg) = 16px * sqrt(2)  */
    --patternHeight: 22.62741699797px;
    box-sizing: content-box;
    margin-right: -1px; /* fix a visual glitch of imperfect alignment */
    width: 4px;
    position: absolute;
    left: -4px;
    top: 0px;
    bottom: 0px;
    pointer-events: none;
    border-top-left-radius: 4px;
    border-bottom-left-radius: 4px;
    border-left-color: var(--normal-cell-color);
    background: var(--normal-cell-color);
    overflow: hidden;
}

pluto-trafficlight::after {
    content: "";
    /* Calc needs units everywhere to work */
    top: calc(0px - 10 * var(--patternHeight));
    left: 0;
    width: 100%;
    height: calc(100% + 10 * var(--patternHeight));
    position: absolute;
    opacity: 0;
}

/*
 * This class will toggle animation.
 * Other classes will make animation visible with opacity (which is CHEAP?)
 * 
 */
pluto-cell.activate_animation pluto-trafficlight::after {
    animation: 10s linear 0s infinite running scrollbackground;
}

/* in ascending order of severity: */
/* we need the :not(.___) to fix our CSS selector specificity when `pluto-editor.disable_ui` */
pluto-editor:not(.___) pluto-cell.code_folded > pluto-trafficlight {
    background: none;
}

@media screen and (any-pointer: fine) {
    pluto-editor:not(.disable_ui) pluto-cell:hover > pluto-trafficlight {
        background: var(--normal-cell-color);
    }
}

pluto-editor:not(.___) pluto-cell:focus-within > pluto-trafficlight {
    border-left-width: 4px;
    border-left-style: solid;
    margin-left: -4px;
    background-clip: padding-box;
    background-color: var(--normal-cell-color);
}

pluto-editor:not(.___) pluto-cell.selected > pluto-trafficlight {
    background: var(--selected-cell-color);
    border-left-color: var(--selected-cell-color);
    background-clip: padding-box;
}

pluto-editor:not(.___) pluto-cell.code_differs > pluto-trafficlight {
    background: var(--code-differs-cell-color);
    border-left-color: var(--code-differs-cell-color);
    background-clip: padding-box;
}

pluto-editor:not(.___) pluto-cell.errored > pluto-trafficlight {
    background: var(--error-cell-color);
    border-left-color: var(--error-cell-color);
    background-clip: padding-box;
}

pluto-editor:not(.___) pluto-cell.queued > pluto-trafficlight::after {
    background: repeating-linear-gradient(-45deg, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0) 8px, var(--normal-cell-color) 8px, var(--normal-cell-color) 16px);
    background-clip: padding-box;
    /* [1]
    Queued, Running, Errored are really fast changing props.
    We make sure to on-off the gradients with opacity and not toggle the animation
    (Which is running all this time)
    Make sure the browser won't skip creating a stacking context
    https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Positioning/Understanding_z_index/The_stacking_context
    https://www.w3.org/TR/css-color-3/#transparency
    */
    opacity: 0.99;
    background-size: 4px var(--patternHeight);
    animation-duration: 20s;
}

pluto-editor:not(.___) pluto-cell.running > pluto-trafficlight::after {
    background: repeating-linear-gradient(
        -45deg,
        var(--normal-cell-color),
        var(--normal-cell-color) 8px,
        var(--dark-normal-cell-color) 8px,
        var(--dark-normal-cell-color) 16px
    );
    background-clip: content-box;
    opacity: 0.99; /* [1] */
    background-size: 4px var(--patternHeight);
}

pluto-editor:not(.___) pluto-cell.queued.errored > pluto-trafficlight::after {
    background: repeating-linear-gradient(
        -45deg,
        var(--light-error-cell-color),
        var(--light-error-cell-color) 8px,
        var(--bright-error-cell-color) 8px,
        var(--bright-error-cell-color) 16px
    );
    background-clip: content-box;
    opacity: 0.99; /* [1] */
    background-size: 4px var(--patternHeight); /* 16 * sqrt(2) */
}

pluto-editor:not(.___) pluto-cell.running.errored > pluto-trafficlight::after {
    background: repeating-linear-gradient(
        -45deg,
        var(--light-error-cell-color),
        var(--light-error-cell-color) 8px,
        var(--bright-error-cell-color) 8px,
        var(--bright-error-cell-color) 16px
    );
    background-clip: content-box;
    opacity: 0.99; /* [1] */
    background-size: 4px var(--patternHeight); /* 16 * sqrt(2) */
}

/* Define --patternHeight for this keyframes animation to work! */
@keyframes scrollbackground {
    0% {
        transform: translate(0px, 0px);
    }
    100% {
        transform: translate(0, calc(10 * var(--patternHeight)));
    }
}

/* BUTTONS */

pluto-cell > button > span,
pluto-input > button > span {
    pointer-events: none;
}

@media screen and (any-pointer: fine) {
    pluto-cell > button,
    pluto-input > button,
    pluto-runarea > button,
    pluto-shoulder > button,
    pluto-cell > pluto-runarea {
        opacity: 0;
        /* to make it feel smooth: */
        transition: opacity 0.25s ease-in-out;
    }
    .export_small_btns button,
    button.toggle_export,
    button.start_stop_recording,
    pluto-cell:hover > button,
    pluto-cell:focus-within > button,
    pluto-cell:hover > pluto-input > button,
    pluto-cell:focus-within > pluto-input > button,
    pluto-cell > pluto-runarea > button,
    pluto-cell:hover > pluto-shoulder > button,
    pluto-cell:focus-within > pluto-shoulder > button,
    :where(pluto-editor.inspecting_hidden_code) pluto-cell > pluto-shoulder > button {
        opacity: 0.6;
        transition: opacity 0.25s ease-in-out;
    }
    .export_small_btns button:hover,
    button.toggle_export:hover,
    button.start_stop_recording:hover,
    .overlay-button button:hover,
    pluto-cell > button:hover,
    pluto-cell > pluto-input > button:hover,
    pluto-cell > pluto-runarea > button:hover,
    pluto-cell > pluto-shoulder > button:hover,
    pluto-cell:hover > pluto-runarea {
        opacity: 1;
        /* to make it feel snappy: */
        transition: opacity 0.05s ease-in-out;
    }
}

@media screen and (pointer: coarse) {
    pluto-cell > button.add_cell,
    pluto-input > button,
    pluto-shoulder > button {
        opacity: 0.25;
        transition: opacity 0.25s ease-in-out;
    }
    pluto-cell:not(:first-of-type, :last-of-type) > button.add_cell {
        /* because there are two overlapping buttons */
        opacity: 0.125;
    }
    /* pluto-cell:first-of-type > button.add_cell.before,
    pluto-cell:last-of-type > button.add_cell.after {
        opacity: 0.25;
    } */
    pluto-cell:focus-within > button.add_cell,
    pluto-cell:focus-within > pluto-input > button,
    pluto-cell:focus-within > pluto-runarea,
    pluto-cell:focus-within > pluto-shoulder > button {
        opacity: 0.6;
        transition: opacity 0.25s ease-in-out;
    }
    pluto-cell > pluto-input > button:focus-within,
    pluto-cell > button:focus-within,
    pluto-cell > pluto-input > button:focus-within pluto-cell > pluto-runarea > button:focus-within,
    pluto-cell > pluto-shoulder > button:focus-within,
    pluto-cell > pluto-runarea {
        opacity: 1;
        /* to make it feel snappy: */
        transition: opacity 0.05s ease-in-out;
    }
}

pluto-cell > button > span::after,
pluto-input > button > span::after,
pluto-runarea > button > span::after,
pluto-shoulder > button > span::after {
    display: block;
    content: " " !important;
    background-size: 17px 17px;
    height: 17px;
    width: 17px;
}

pluto-cell > button.add_cell {
    left: -12px;
    --hit-box-extend: 20px;
    margin-left: calc(-1 * var(--hit-box-extend));
    margin-right: calc(-1 * var(--hit-box-extend));
    padding-left: var(--hit-box-extend);
    padding-right: var(--hit-box-extend);
}

pluto-cell > button.add_cell.before {
    margin-top: calc(-19px - 0.5 * (var(--pluto-cell-spacing) - 19px)) !important;
}

pluto-cell > button.add_cell.after {
    bottom: 1px;
    margin-bottom: calc(-20px - 0.5 * (var(--pluto-cell-spacing) - 19px));
}

pluto-cell > button.add_cell > span::after {
    /* background-image: url("https://cdn.jsdelivr.net/gh/ionic-team/ionicons@5.5.1/src/svg/add-circle-outline.svg"); */
    background-image: url("https://cdn.jsdelivr.net/gh/ionic-team/ionicons@5.5.1/src/svg/add-outline.svg");
    filter: var(--image-filters);
}

pluto-input > .input_context_menu ul {
    margin: 0;
    padding: 0px;
    border-radius: 6px;
    display: grid;
    grid-template-columns: max-content;
    border: 1px solid var(--input-context-menu-border-color);
    background-color: var(--input-context-menu-bg-color);
}

pluto-input {
    position: relative;
    display: block;
}
pluto-input > div.input_context_menu {
    left: 100%;
    top: -8px;
    position: absolute;
    z-index: 1400;
}
@media screen and (min-width: 921px) {
    pluto-input > div.input_context_menu {
        left: calc(100% - 3px);
    }
}
@media screen and (max-width: 920px) {
    pluto-input > div.input_context_menu {
        right: 0px;
        left: unset;
        z-index: 1401;
    }
}

pluto-input > .input_context_menu li {
    list-style: none;
    margin-block-end: 0px;
    display: flex;
    align-items: stretch;
    flex-direction: column;
}
pluto-input > .input_context_menu li button {
    font-family: var(--system-ui-font-stack);
    font-size: 0.9rem;
    margin-block-end: 0px;
    color: var(--input-context-menu-li-color);
    position: relative;
    padding: 8px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    border-radius: 2px;
    cursor: pointer;
    background: none;
    border: none;
}
.input_context_menu li:last-child {
    border-bottom-left-radius: 6px;
    border-bottom-right-radius: 6px;
}
.input_context_menu li:first-child {
    border-top-left-radius: 6px;
    border-top-right-radius: 6px;
}

.input_context_menu li.coming_soon {
    color: var(--input-context-menu-soon-color);
}
.input_context_menu li.coming_soon:hover {
    cursor: not-allowed;
    background-color: var(--input-context-menu-hover-bg-color);
}

.input_context_menu li:hover {
    transition-property: background-color;
    transition-duration: 200ms;
    background-color: var(--input-context-menu-hover-bg-color);
}

.ctx_icon,
.icon {
    --size: 17px;
    width: var(--size);
    height: var(--size);
    margin-top: 1px;
    background-size: var(--size) var(--size);
    background-position: center;
    margin-right: calc(var(--size) / 3);
}

.ctx_icon {
    filter: var(--image-filters);
}
.ctx_icon.show_logs {
    background-image: url("https://cdn.jsdelivr.net/gh/ionic-team/ionicons@5.5.1/src/svg/document-text-outline.svg");
}

.ctx_icon.hide_logs {
    background-image: url("https://cdn.jsdelivr.net/gh/ionic-team/ionicons@5.5.1/src/svg/document-text-outline.svg");
}
.ctx_icon.enable_cell {
    background-image: url("https://cdn.jsdelivr.net/gh/ionic-team/ionicons@5.5.1/src/svg/caret-forward-circle-outline.svg");
}

.ctx_icon.disable_cell {
    background-image: url("https://cdn.jsdelivr.net/gh/ionic-team/ionicons@5.5.1/src/svg/ban-outline.svg");
    background-size: 15px;
    background-repeat: no-repeat;
}
.ctx_icon.delete {
    background-image: url("https://cdn.jsdelivr.net/gh/ionic-team/ionicons@5.5.1/src/svg/close-circle-outline.svg");
}
.ctx_icon.run_as_script {
    background-image: url("https://cdn.jsdelivr.net/gh/ionic-team/ionicons@5.5.1/src/svg/document-lock-outline.svg");
}
.ctx_icon.skip_as_script {
    background-image: url("https://cdn.jsdelivr.net/gh/ionic-team/ionicons@5.5.1/src/svg/document-text-outline.svg");
}

.ctx_icon.copy_output {
    background-image: url("https://cdn.jsdelivr.net/gh/ionic-team/ionicons@5.5.1/src/svg/copy-outline.svg");
}

.ctx_icon.ask_ai {
    background-image: url("https://cdn.jsdelivr.net/gh/ionic-team/ionicons@5.5.1/src/svg/chatbubble-ellipses-outline.svg");
}

pluto-input > button.input_context_menu {
    /* top: 3px; */
    /* left: -26px; */
    right: 0px;
    padding: 5px;
}

pluto-input > .input_context_menu.open {
    opacity: 1;
}

pluto-input > .input_context_menu span.icon::after {
    background-image: url("https://cdn.jsdelivr.net/gh/ionic-team/ionicons@5.5.1/src/svg/ellipsis-horizontal-circle-outline.svg");
    filter: var(--image-filters);
}

pluto-input > .preview_hidden_code_info {
    display: none;
    position: absolute;
    bottom: -1.1rem;
    left: 0;
    right: 0;
    margin-right: auto;
    margin-left: auto;
    height: 1.4rem;
    max-width: max-content;
    padding: 0em 1ch;
    font-style: italic;
    text-align: center;
    background: var(--jl-info-color);
    border-radius: 0.4rem;
    font-family: var(--system-ui-font-stack);
    font-size: 0.9rem;
    z-index: 22;
    pointer-events: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

pluto-editor:not(.process_waiting_for_permission) pluto-cell.code_folded > pluto-input > .preview_hidden_code_info,
pluto-cell.inspecting_hidden_code > pluto-input > .preview_hidden_code_info,
pluto-cell.code_folded:focus-within > pluto-input > .preview_hidden_code_info {
    display: block;
}

/* AI Context */

pluto-popup.ai-context > div {
    background: var(--ai-gradient-bg);
    box-shadow: 0 0 3rem #00000061;
}

.ai-context-container {
    padding: 0.2rem;
}

.ai-context-container h2 {
    margin: 0 0 0.5rem 0;
    font-size: 1.2rem;
    color: var(--pluto-output-h-color);
}

.ai-context-intro {
    margin: 0.5rem 0;
    font-size: 0.9rem;
    color: var(--pluto-output-color);
}

.ai-context-question-input {
    width: 100%;
    padding: 8px 12px;
    margin: 8px 0;
    border: 3px solid transparent;
    border-radius: 4px;
    font-size: 0.95em;
    background: var(--main-bg-color);
    transition: border-color 0.2s;
}

.ai-context-question-input:focus,
.ai-context-question-input:not(:placeholder-shown) {
    outline: none;
    border-color: var(--overlay-button-border);
}

.ai-context-question-input::placeholder {
    color: var(--pluto-input-color);
    opacity: 0.6;
}

.ai-context-prompt-container {
    position: relative;
    margin-top: 1rem;
    border-radius: 6px;
    box-shadow: 0 2px 11px #0000001f;
    background: var(--ai-prompt-bg);
}

.ai-context-prompt {
    max-height: 15ch;
    overflow-y: auto;
    padding: 0.5rem;
    line-height: 1.5;
}

.ai-context-prompt pre {
    margin: 0;
    white-space: pre-wrap;
    word-wrap: break-word;
    font-family: inherit;
    font-size: 0.5rem;
}

.ai-context-container .copy-button {
    position: absolute;
    bottom: 0.5rem;
    right: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--white);
    border: 3px solid var(--overlay-button-border);
    border-radius: 0.7rem;
    color: var(--black);
    font-size: 0.9rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    /* box-shadow: 0 1px 10px #0000001a; */
}

.ai-context-container .copy-button.copied {
    /* color: var(--pluto-output-bg); */
}

/* PKG UI */

pkg-status-mark {
    width: 1em;
    height: 1em;
    margin: 0px 0.6em 0px 0.2em;
    display: inline-block;
}
pluto-editor.nbpkg_disabled pkg-status-mark:not(.disable_pkg) {
    display: none;
}

pkg-status-mark > button {
    margin: 0px;
    padding: 0px;
    border: none;
    background: none;
    cursor: context-menu;
    position: relative;
    top: -0.2em;

    /* background: rgba(127, 176, 76, 0.24);
    border: 3px solid rgba(84, 182, 237, 0);
    border-radius: 5px; */
}

pkg-status-mark > button > span::after {
    display: inline-block;
    content: " " !important;
    background-size: 1.5em;
    height: 1.5em;
    width: 1.5em;

    background-image: url("https://cdn.jsdelivr.net/gh/ionic-team/ionicons@5.5.1/src/svg/time-outline.svg");
    opacity: 0.3;
    filter: var(--image-filters);
}

pkg-status-mark.installed > button > span::after {
    background-image: url("https://cdn.jsdelivr.net/gh/ionic-team/ionicons@5.5.1/src/svg/checkmark-outline.svg");
    /* background-image: url("https://cdn.jsdelivr.net/gh/ionic-team/ionicons@5.5.1/src/svg/cloud-done-outline.svg"); */
    filter: var(--image-filters);
}
pkg-status-mark.busy > button > span::after {
    background-image: url("https://cdn.jsdelivr.net/gh/ionic-team/ionicons@5.5.1/src/svg/sync-outline.svg");
    animation: loadspin 3s ease-in-out infinite;
    filter: var(--image-filters);
}
pkg-status-mark.not_found > button > span::after {
    background-image: url("https://cdn.jsdelivr.net/gh/ionic-team/ionicons@5.5.1/src/svg/cloud-offline-outline.svg");
    opacity: 0.6;
    filter: var(--image-filters);
}
pkg-status-mark.will_be_installed > button > span::after {
    background-image: url("https://cdn.jsdelivr.net/gh/ionic-team/ionicons@5.5.1/src/svg/cloud-download-outline.svg");
    opacity: 0.6;
    filter: var(--image-filters);
}
pkg-status-mark.disable_pkg > button > span::after {
    background-image: url("https://cdn.jsdelivr.net/gh/ionic-team/ionicons@5.5.1/src/svg/chatbox-ellipses-outline.svg");
    opacity: 0.6;
    filter: var(--image-filters);
}

pluto-popup {
    display: block;
    position: absolute;
    z-index: 1800;
    /* left: 1.5em; */
    /* top: calc((1.5em - 200px) * 0.5); */
    --max-size: 251px;
    width: min(90vw, var(--max-size));
    /* min-height: 80px; */
    margin-left: 0.4rem;
    margin-top: 0px;
    margin-top: -1rem;
    /* margin-top: calc(0.5 * (1rem - 80px)); */
    overflow-wrap: break-word;
    font-family: var(--system-ui-font-stack);
    opacity: 0;
    transform: scale(0.2);
    transform-origin: left;
    transition: transform 0.5s ease-in-out, opacity 0.1s ease-in-out;
    pointer-events: none;
}

pluto-popup.visible {
    opacity: 1;
    transform: scale(1);
    transition: transform 0.2s ease-in-out, opacity 0.2s ease-in-out;
    pointer-events: initial;
}

pluto-popup.big {
    --max-size: 25em;
}

pluto-popup > * {
    display: block;
    background: var(--overlay-button-bg);
    border: 3px solid var(--overlay-button-border);
    color: var(--black);
    border-radius: 10px;
    padding: 8px;
    /* Slightly changes the layout of the three pkg buttons... in just the way that we want it! */
    position: absolute;
    max-width: 100%;
    max-height: 80vh;
    overflow-y: auto;
}

pluto-popup > div > *:first-child {
    margin-block-start: 0;
}

pluto-popup h1 {
    font-size: 1.6em;
}

pluto-popup.warn > * {
    background: var(--pluto-logs-warn-color);
    border-color: var(--pluto-logs-warn-accent-color);
}

pluto-popup code.auto_disabled_variable {
    font-family: var(--julia-mono-font-stack);
    font-size: 0.8rem;
    font-variant-ligatures: none;
}

pluto-popup > pkg-popup {
    background: var(--pkg-popup-bg);
    border: 3px solid var(--pkg-popup-border-color);
}

pkg-popup.busy {
    border: 3px solid hsl(282deg 31% 62%);
}

pkg-version {
    font-family: monospace;
    font-size: 0.75rem;
    color: var(--pkg-version-color);
}

pkg-popup .pkg-buttons {
    float: right;
    /* position: absolute; */
    /* right: 0px; */
    /* bottom: 0px; */
    display: inline-flex;
    height: 1em;
    flex-direction: row;
}

.ionicon {
    filter: var(--image-filters);
}

.package-name .ionicon {
    margin-bottom: -0.1ch;
}

a.stdout-info img,
pkg-popup .pkg-buttons img {
    filter: var(--image-filters);
    width: 17px;
}

a.stdout-info,
pkg-popup .pkg-buttons > * {
    display: block;
    height: 17px;
    padding: 4px;
    box-sizing: content-box;
    background: var(--pkg-popup-buttons-bg-color);
    border-radius: 10px;
    z-index: 52;
    margin-left: -4px;
}

pkg-popup .toggle-terminal {
    right: 20px;
}

.pkg-time-estimate {
    font-size: 0.8em;
    margin: 0.5em 0em;
    padding: 0.5em 0.5em;
    background: var(--pluto-logs-warn-color);
    border-radius: 0.5em;
}

pkg-terminal {
    position: relative;
    display: block;
    /* width: 20rem; */
    cursor: text;
    margin-top: 6px;
    background: var(--pkg-terminal-bg-color);
    color: white;
    border-radius: 6px;
    border: 3px solid var(--pkg-terminal-border-color);
    padding: 3px;
}

pkg-terminal > .scroller {
    max-height: 10rem;
    overflow-y: auto;
    padding: 4px;
    width: 100%;
}

body pkg-terminal:not(.asdf) pre:not(.asdf) {
    white-space: pre-wrap;
    word-break: break-all;
    font-size: 0.6rem;
    font-family: monospace;
    font-variant-ligatures: none;
    margin: 0;
    color: inherit;
    background: none;
}

pkg-terminal .make-me-spin {
    display: inline-block;
    animation: identifier-spin 1s linear infinite;
    transform-origin: 50% 59%;
    animation-delay: var(--animation-delay);
}

pkg-popup pkg-terminal {
    display: none;
}

pkg-popup.showterminal pkg-terminal {
    display: block;
}

@keyframes loadspin {
    0% {
        transform: rotate(0deg);
    }
    25% {
        transform: rotate(180deg);
    }
    50% {
        transform: rotate(180deg);
    }
    75% {
        transform: rotate(360deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

button.open-big-terminal {
    position: absolute;
    right: 0.1em;
    bottom: 0.2em;
    background: none;
    border: none;
}

button.open-big-terminal::after {
    content: "";
    display: inline-block;
    background-image: url("https://cdn.jsdelivr.net/gh/ionic-team/ionicons@5.5.1/src/svg/expand-outline.svg");
    filter: invert(1);
    width: 1em;
    height: 1em;
    background-size: 1em;
    cursor: pointer;
}

dialog.big-pkg-terminal {
    border: none;
    border-radius: 8px;
    box-shadow: 0 0 31px #0000007a;
    background: var(--pkg-terminal-bg-color);
}

dialog.big-pkg-terminal > div {
    display: flex;
    flex-direction: column;
}
dialog.big-pkg-terminal button {
    place-self: end;
    margin-top: 1em;
}

dialog.big-pkg-terminal pkg-terminal > .scroller {
    max-height: calc(100vh - 9em);
    max-width: 91ch;
}

/* RUNAREA */

pluto-runarea {
    margin-right: 3px;
    display: block;
    height: 17px;
    position: absolute;
    right: 0px;
    min-width: 75px;
    background-color: var(--pluto-runarea-bg-color);
    /* border: 2px solid hsla(0, 0%, 0%, 0.1); */
    border-bottom-left-radius: 5px;
    border-bottom-right-radius: 5px;
    border-top: none;
    /* One less than z-index for pluto-input .cm-editor.
       Otherwise it gets on top of the tooltips */
    z-index: 19;
}

pluto-runarea > span {
    display: inline-block;
    position: absolute;
    top: 1px;
    left: 22px;
    width: 45px;

    font-family: var(--roboto-mono-font-stack);
    font-size: 0.6em;
    font-style: italic;
    color: var(--pluto-runarea-span-color);
    text-align: center;
}

pluto-runarea > button.runcell {
    top: -1px;
    left: 1px;
}

pluto-runarea > button.runcell > span::after {
    background-image: url("https://cdn.jsdelivr.net/gh/ionic-team/ionicons@5.5.1/src/svg/caret-forward-circle-outline.svg");
    filter: var(--image-filters);
}

pluto-runarea.interrupt > button.runcell > span::after {
    background-image: url("https://cdn.jsdelivr.net/gh/ionic-team/ionicons@5.5.1/src/svg/stop-circle-outline.svg");
    filter: var(--image-filters);
}

pluto-runarea.jump > button.runcell > span::after {
    background-image: url("https://cdn.jsdelivr.net/gh/ionic-team/ionicons@5.5.1/src/svg/arrow-redo-circle-outline.svg");
    filter: var(--image-filters);
}
pluto-runarea.save > button.runcell > span::after {
    background-image: url("https://cdn.jsdelivr.net/gh/ionic-team/ionicons@5.5.1/src/svg/chevron-forward-circle-outline.svg");
    filter: var(--image-filters);
}

pluto-cell:not(.show_input) > pluto-runarea {
    display: none;
}
pluto-cell.code_folded.show_input > pluto-input:not(:focus-within) {
    opacity: 0.4;
}

pluto-cell:focus-within > pluto-runarea,
pluto-cell.code_differs > pluto-runarea {
    opacity: 100%;
}

pluto-cell.code_differs > pluto-runarea > button {
    animation-name: 👀;
    animation-duration: 4s;
    animation-iteration-count: infinite;
}

@keyframes 👀 {
    0%,
    80%,
    100% {
        transform: scale(1);
        opacity: 50%;
    }
    90% {
        transform: scale(1.2);
        opacity: 100%;
    }
}

/* DRAG DROP */

dropruler {
    position: absolute;
    display: none;
    left: 0px;
    right: 0px;
    height: 4px;
    margin-top: calc(-2px - 0.5 * var(--pluto-cell-spacing));
    background: var(--dropruler-bg-color);
    transition: top 0.05s;
}

/* LIVE DOCS */

#helpbox-wrapper {
    display: none;
    position: sticky;
    bottom: 0px;
    height: 0px;
    width: 100%;
    z-index: 50;
}

@media (min-width: 500px) {
    #helpbox-wrapper {
        display: block;
    }
}
pluto-helpbox {
    bottom: 0px;
    right: 20px;
    position: absolute;
    display: flex;
    flex-direction: column;
    width: calc(100vw - 50px - (700px + 25px + 6px)); /* compat */
    width: clamp(300px, calc(100vw - 50px - (700px + 25px + 6px)), 450px);
    height: 95vh; /* compat */
    height: min(70vh, 900px);
    /* overflow: hidden; */
    background-color: var(--helpbox-bg-color);
    color: var(--helpbox-text-color);
    /* border: 2px solid darkgray; */
    border-right: none;
    border-bottom: none;
    border-top-left-radius: 9px;
    border-top-right-radius: 9px;
    box-shadow: 0 0 11px 0px var(--helpbox-box-shadow-color);
}
pluto-helpbox > section {
    height: 100%;
    overflow: auto;
    padding: 10px;
    display: flex;
    flex-direction: column;
}

pluto-helpbox > header {
    display: flex;
    padding: 0.6em;
    background-color: var(--helpbox-header-bg-color);
    color: var(--helpbox-header-color);
    font-family: var(--system-ui-font-stack);
    font-variant-numeric: tabular-nums;
    font-size: 0.9rem;
    --border-radius: 0.4em;
    font-weight: 500;
    border-top-left-radius: var(--border-radius);
    border-top-right-radius: var(--border-radius);
    /* border-top: 4px solid #8a8a8a; */
    gap: 0.5em;
}

pluto-helpbox > header > button.helpbox-tab-key > .tabicon {
    /* font-size: 1em; */
    --size: 1.1em;
    width: var(--size);
    height: var(--size);
    background-size: var(--size);
    margin-bottom: calc(-0.15 * var(--size));
    filter: var(--image-filters);
    margin-right: 0.6em;
    display: inline-block;
}
pluto-helpbox > header > button.helpbox-docs > .tabicon {
    background-image: url("https://cdn.jsdelivr.net/gh/ionic-team/ionicons@5.5.1/src/svg/search.svg");
    /* content: "📚 "; */
}

pluto-helpbox > header > button.helpbox-docs.active > .tabicon {
    /* content: "📖 "; */
}
pluto-helpbox > header > button.helpbox-process > .tabicon {
    background-image: url("https://cdn.jsdelivr.net/gh/ionic-team/ionicons@5.5.1/src/svg/terminal.svg");
    background-image: url("https://cdn.jsdelivr.net/gh/ionic-team/ionicons@5.5.1/src/svg/pulse.svg");
    /* content: "💻 "; */
}

pluto-helpbox > header > button.helpbox-tab-key:disabled > .tabicon {
    /* display: none; */
    opacity: 0.5;
}
/* 
button.helpbox-process.helpbox-tab-key::before {
    content: "";
    display: block;
    position: absolute;
    --offset: -5px;
    top: var(--offset);
    right: var(--offset);
    left: var(--offset);
    bottom: var(--offset);
    background: var(--process-busy);
    border-radius: var(--border-radius);
    background: linear-gradient(447deg, var(--process-finished), var(--process-finished) 50%, var(--process-busy) 50%, var(--process-busy));
    background: linear-gradient(
        447deg,
        var(--process-busy) 0%,
        var(--process-busy) 25%,
        var(--process-finished) 25%,
        var(--process-finished) 50%,
        var(--process-busy) 50%,
        var(--process-busy) 75%,
        var(--process-finished) 75%,
        var(--process-finished) 100%
    );
    animation: move-bg 5s linear infinite;
    background-size: 100px auto;
    z-index: -1;
    opacity: 0.6;
} */

/* @keyframes rotate-bg {
    0% {
        background: linear-gradient(
            0deg,
            var(--process-busy) 0%,
            var(--process-busy) 20%,
            var(--process-finished) 20%,
            var(--process-finished) 40%,
            var(--process-busy) 40%,
            var(--process-busy) 60%,
            var(--process-finished) 60%,
            var(--process-finished) 80%,
            var(--process-busy) 80%,
            var(--process-busy)
        );
    }
    100% {
        background: linear-gradient(
            70deg,
            var(--process-busy) 0%,
            var(--process-busy) 20%,
            var(--process-finished) 20%,
            var(--process-finished) 40%,
            var(--process-busy) 40%,
            var(--process-busy) 60%,
            var(--process-finished) 60%,
            var(--process-finished) 80%,
            var(--process-busy) 80%,
            var(--process-busy)
        );
    }
} */
/* 
@keyframes move-bg {
    0% {
        background-position-x: 0;
    }
    100% {
        background-position-x: 100px;
    }
}

button.helpbox-process.helpbox-tab-key::after {
    content: "";
    display: block;
    position: absolute;
    top: 0;
    right: 0;
    left: 0;
    bottom: 0;
    border-radius: var(--border-radius);
    border: none;
    background: var(--helpbox-header-tab-bg-color);
    z-index: -1;
} */

pluto-helpbox .live-docs-searchbox {
    display: flex;
    margin: 1em;
}

pluto-helpbox .live-docs-searchbox input {
    flex-grow: 1;
    background-color: inherit;
    color: inherit;
    border: none;
    padding: 0.5em;
    margin: auto;
    border: 3px solid var(--helpbox-search-border-color);
    border-radius: 0.3em;
    background: var(--helpbox-search-bg-color);
    font-family: var(--julia-mono-font-stack);
    font-size: 0.9rem;
}
pluto-helpbox .live-docs-searchbox.notfound input {
    color: var(--helpbox-notfound-search-color);
}
pluto-helpbox .live-docs-searchbox input:focus {
    outline: none;
}

button.helpbox-tab-key {
    padding: 0.5em 0.6em;
    cursor: pointer;
    font-family: inherit;
    font-weight: inherit;
    font-style: inherit;
    font-size: inherit;
    font-variant: inherit;
    border-radius: var(--border-radius);
    border: none;
    background: var(--helpbox-header-tab-bg-color);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    /* position: relative; */
    /* flex: 1 1 auto; */
    /* z-index: 1; */
    /* overflow: hidden; */
}

button.helpbox-tab-key.helpbox-process {
    margin-right: auto;
}

button.helpbox-process.busy {
    outline: 6px solid var(--process-busy);
}

@media (prefers-reduced-motion: no-preference) {
    button.helpbox-process.busy {
        animation: outline-heartbeat 0.8s ease-in infinite;
        animation-direction: alternate;
    }
}
@keyframes outline-heartbeat {
    0% {
        outline-offset: -1px;
        outline-width: 3px;
    }
    100% {
        outline-offset: 0px;
        outline-width: 6px;
    }
}

button.active.helpbox-tab-key {
    outline: 3px solid #99afb9;
    animation: none;
}

pluto-helpbox > header > button:is(.helpbox-close, .helpbox-popout) {
    border: none;
    background: none;
    cursor: pointer;

    /* for bigger hitbox */
    margin: -15px;
    border: 15px solid transparent;
}

pluto-helpbox > header > button:is(.helpbox-close, .helpbox-popout) > span {
    display: block;
    content: " " !important;
    background-size: 1em 1em;
    height: 1em;
    width: 1em;
    background-image: url("https://cdn.jsdelivr.net/gh/ionic-team/ionicons@5.5.1/src/svg/chevron-down-outline.svg");
    filter: var(--image-filters);
}
pluto-helpbox > header > button.helpbox-popout > span {
    background-image: url("https://cdn.jsdelivr.net/gh/ionic-team/ionicons@5.5.1/src/svg/open-outline.svg");
}
pluto-helpbox.hidden {
    height: initial;
    width: auto;
}
pluto-helpbox.hidden > section {
    display: none;
}

/* pop out */
body > pluto-helpbox {
    position: static;
    width: auto;
    height: 100vmax;
}
body > pluto-helpbox > header > button:is(.helpbox-close, .helpbox-popout) {
    display: none;
}

/* NOTE */
/* We try to match the visual style of Documenter.jl, so we have copied over some rules from */
/* https://docs.julialang.org/en/v1/assets/themes/documenter-light.css */
/* see https://github.com/JuliaDocs/Documenter.jl for author information */

.helpbox-docs {
    font-family: var(--lato-ui-font-stack);
    line-height: 1.4;
    font-size: 0.9rem;
}
.helpbox-docs pre,
.helpbox-docs code,
.helpbox-docs .cm-line {
    /* from https://docs.julialang.org/en/v1/assets/themes/documenter-light.css */
    font-family: var(--julia-mono-font-stack);
    font-variant-ligatures: none;
    font-size: calc(0.8em / 0.9);
    line-height: initial;
}
.helpbox-docs pre code {
    font-size: 1em;
}

.helpbox-docs pre code.hljs {
    padding: 0;
}

.helpbox-docs code .cm-editor .cm-content {
    padding: 0px;
}

.helpbox-docs img {
    max-width: 100%;
}

.helpbox-docs > section h1,
.helpbox-docs > section h2,
.helpbox-docs > section h3,
.helpbox-docs > section h4,
.helpbox-docs > section h5,
.helpbox-docs > section h6 {
    font-family: inherit;
    border-bottom: none;
    font-size: 1rem;
    margin-block-end: 0;
}
.helpbox-docs > section h1 {
    font-size: 1.3rem;
    overflow-wrap: anywhere;
}
.helpbox-docs > section pre {
    padding: 0.7rem 0.5rem;
    -webkit-overflow-scrolling: touch;
    overflow-x: auto;
    background: var(--code-section-bg-color);
    border: 1px solid var(--code-section-border-color);
    border-radius: 4px;
    white-space: pre;
    word-wrap: normal;
}
/* .helpbox-docs > section code {
    background-color: whitesmoke;
    padding: 0.1em;
} */
.helpbox-docs > section hr {
    border: none;
    border-top: 3px solid var(--rule-color);
}

.pluto-docs-binding {
    margin: 0.5em;
    padding: 1em;
    border-radius: 1em;
    background: var(--docs-binding-bg);
    color: var(--pluto-output-color);
}

.pluto-docs-binding > span {
    display: inline-block;
    transform: translate(-1.2em, -73%);
    font-family: var(--julia-mono-font-stack);
    font-size: 0.9rem;
    font-weight: 700;
    margin-top: -1em;
    padding: 0.235rem;
    border-radius: 0.4rem;
    background: var(--pluto-output-bg-color);
    color: var(--black);
}

.pluto-docs-binding h1 {
    font-size: 1.4em;
}

.pluto-docs-binding h2 {
    font-size: 1.3em;
}
.pluto-docs-binding h3,
.pluto-docs-binding h4,
.pluto-docs-binding h5,
.pluto-docs-binding h6 {
    font-size: 1.1em;
}

/* PROCESS TAB */

pl-status {
    --status-color: var(--process-undefined);
    font-family: var(--system-ui-font-stack);
    font-size: 0.9rem;
    display: flex;
    flex-direction: column;
    border-radius: 0.2em;
    --indent: 0.7rem;
    margin-left: var(--indent);
    border-left: 3px solid transparent;
    margin-top: 0.4em;
    overflow: hidden;
    flex: 0 0 auto;
}

pl-status::before {
    flex: 1 2 auto;
    /* content: ""; */
    display: inline-block;
    left: 0;
    right: 0px;
    width: 3px;
    height: 10px;
    bottom: 3px;
    top: 3px;
    background: pink;
}

pl-status.busy {
    --status-color: var(--process-busy);
}
pl-status.finished {
    --status-color: var(--process-finished);
}
pl-status.failed {
    --status-color: var(--process-failed);
}

pl-status.can_open {
    cursor: auto;
    border-color: #98989854;
}
pl-status.can_open > div {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    cursor: pointer;
}
pl-status.can_open.is_open {
    border-color: var(--status-color);
}

pl-status[data-depth="0"],
pl-status[data-depth="1"] {
    margin-left: 0;
}

pl-status > div {
    display: flex;
    flex-direction: row;
    align-items: center;
    /* margin: 0em 0em 0.4em 0; */
    padding: 0.2em;
    background: var(--process-item-bg);
    border-radius: 0.4em;
    /* flex: 1 0 auto; */
}

pl-status > div > .status-icon {
    content: "";
    display: inline-block;
    width: 1em;
    height: 1em;
    border-radius: 50%;
    background-color: var(--status-color);
    /* border: 3px solid green; */
    margin: 0em 0.5em;
    flex: 0 0 auto;
}

pl-status.busy > div > .status-icon {
    border: 3px solid transparent;
    border-right-color: hsl(126deg 30% 60%);
    border-bottom-color: hsl(126deg 30% 60%);
    /* border-left-color: hsl(126deg 30% 60%); */
    animation: identifier-spin 1.7s linear infinite;
}

@keyframes identifier-spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

.subprogress-counter {
    opacity: 0.5;
    /* font-variant-numeric: tabular-nums; */
    font-size: 0.8em;
}

pl-status .status-time {
    margin-left: auto;
    /* align-self: end; */
    padding-right: 0.5em;
    padding-left: 0.5em;
    opacity: 0.6;
    font-size: 0.7rem;
    font-variant-numeric: tabular-nums;
}

.discrete-progress-bar {
    display: flex;
    flex-direction: row;
    background: var(--process-item-bg);
    padding: 3px;
    border-radius: 4px;
    gap: 2px;
    contain: strict;
    height: 1em;
    align-items: stretch;
}

.discrete-progress-bar > div {
    background: var(--process-undefined);
    flex: 1 1 auto;
    border-radius: 2px;
    /* margin: 0.4px; */
}

.discrete-progress-bar > div.done {
    background: var(--process-finished);
}
.discrete-progress-bar > div.busy {
    background: var(--process-busy);
}
.discrete-progress-bar > div.failed {
    background: var(--process-failed);
}

.discrete-progress-bar.mid {
    gap: 1px;
}

.discrete-progress-bar.big {
    gap: 0px;
}

pl-status pkg-terminal {
    margin-left: var(--indent);
}

pluto-helpbox.helpbox-process > section {
    padding-bottom: 3.6rem; /* to make space for the notification toggle */
}

.notify-when-done {
    position: absolute;
    bottom: 0.3em;
    right: 0;
    left: 0;

    font-family: var(--system-ui-font-stack);
    font-weight: bold;
    font-size: 0.8rem;
    transition: opacity 0.2s;
    display: flex;
    justify-content: center;
    opacity: 0;
    user-select: none;
}

.notify-when-done.visible {
    opacity: 1;
}

.notify-when-done.visible label {
    cursor: pointer;
}

.notify-when-done label {
    display: flex;
    align-items: center;
    background: var(--process-notify-bg);
    padding: 0.3em 0.6em;
    border-radius: 1000px;
    box-shadow: 0px 3px 5px #0000003b;
}

.notify-when-done label::before {
    content: "";
    display: inline-block;
    width: 1em;
    height: 1em;
    background-image: url("https://cdn.jsdelivr.net/gh/ionic-team/ionicons@5.5.1/src/svg/notifications-outline.svg");
    background-size: contain;
    filter: var(--image-filters);
    margin-bottom: -0.2em;
    margin-right: 0.3em;
}

/* FOOTER */

footer {
    width: 100%;
    min-height: 3.5rem;
    font-family: var(--roboto-mono-font-stack);
    font-size: 0.75rem;
    background-color: var(--footer-bg-color);
    color: var(--footer-color);
    z-index: 70;
}

footer form {
    min-height: 1.5rem;
    opacity: 1;
    transition: opacity 5s;
    display: flex;
    flex: 0 1 max-content;
    min-width: 0;
}

footer form > * {
    flex: 0 0 auto;
}

footer form > a,
footer form > label {
    align-self: center;
}

footer form > label {
    margin-right: 1em;
    flex: 0 1 auto;
    overflow: hidden;
    text-overflow: ellipsis;
    text-wrap: nowrap;
}

footer form > a {
    margin-right: 1em;
}

footer a {
    color: var(--footer-atag-color);
    opacity: 0.6;
    font-weight: 700;
    flex: 0 0 auto;
}

@media (max-width: 500px) {
    footer form {
        display: none;
    }
}

footer input {
    margin: 0px;
    border: 2px solid var(--footer-input-border-color);
    background: var(--white);
    font-family: inherit;
    font-size: inherit;
    border-radius: 3px 0 0 3px;
    padding: 3px;
    border-right: none;
}

header#pluto-nav pluto-filepicker button,
footer button {
    margin: 0px;
    background: var(--footer-filepicker-focus-color);
    border-radius: 0 3px 3px 0;
    border: 3px solid var(--footer-filepicker-focus-color);
    color: var(--footer-filepicker-button-color);
    /* border: none; */
    font-family: inherit;
    font-weight: 600;
    height: auto;
    font-size: 0.75rem;
    flex-shrink: 0;
}

footer #info {
    max-width: 9400px;
    margin: 0 auto;
    padding: 1rem;
    text-align: right;
    /* height: 1.5rem; */
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-end;
}

/* LANGUAGE PICKER */

.language-picker {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-right: 1rem;
    font-size: 0.75rem;
    flex: 0 2 auto;
}

.language-picker label {
    color: var(--footer-color);
    font-weight: 500;
    white-space: nowrap;
}

.language-picker select {
    background: var(--white);
    border: 2px solid var(--footer-input-border-color);
    border-radius: 3px;
    padding: 2px 4px;
    font-family: inherit;
    font-size: inherit;
    color: var(--footer-color);
    cursor: pointer;
    /* width: 78px; */
    width: 100%;
    font-family: var(--system-ui-font-stack);
}

.language-picker select:focus {
    outline: 2px solid var(--footer-filepicker-focus-color);
    outline-offset: 1px;
}

/* UNDO DELETED CELL */

nav#undo_delete {
    z-index: 2000;
    display: block;
    position: fixed;
    bottom: 0px;
    left: 0px;
    margin: 0.75rem;
    padding: 0.5rem;
    font-family: var(--system-ui-font-stack);
    font-size: 0.8rem;
    background-color: var(--helpbox-header-tab-bg-color);
    border-radius: 8px;
    color: var(--black);
    box-shadow: 00px 00px 10px 2px var(--undo-delete-box-shadow-color);
    opacity: 1;
    transition: 0.2s linear box-shadow, 0.2s ease-out margin-bottom, 0.05s linear opacity;
}

nav#undo_delete.hidden {
    margin-bottom: 0px;
    box-shadow: 00px 00px 10px -5px var(--undo-delete-box-shadow-color);
    opacity: 0;
    pointer-events: none;
}

@keyframes shadow-fadeout {
    0% {
        box-shadow: 00px 00px 10px 2px var(--undo-delete-box-shadow-color);
        opacity: 1;
    }
    80% {
        opacity: 1;
    }
    100% {
        opacity: 0;
    }
}

/* LOGS */

@media screen and (max-width: calc(700px + 25px + 6px + 100px)) {
    pluto-cell.shrunk {
        /* max-width: calc(100% - 100px); */
    }
}

pluto-logs-container {
    display: block;

    /* Show logs up to the RunArea */
    z-index: 25;
    overflow-x: hidden;
    overflow-y: auto;
    max-height: 50vh;
    margin-right: 1.3rem;
}

pluto-logs-container:not(:empty) {
    background: var(--pluto-logs-bg-color);
    padding: 6px;
}

pluto-logs-container > header {
    font-family: var(--roboto-mono-font-stack);
    font-size: 1.3rem;
    padding: 0.2em;
    padding-bottom: 0;
    opacity: 0.6;
    font-weight: 700;
    /* background: #494949; */
}

pluto-logs-container pluto-progress-bar-container {
    overflow: hidden;
    outline: 3px solid var(--pluto-logs-progress-border);
    outline-offset: -2px;
    border-radius: 6px;
    background: var(--pluto-logs-progress-bg);
    font-size: 0.7rem;
    flex: 0 1 200px;
}

pluto-logs-container pluto-progress-name {
    white-space: pre-wrap;
    font-family: var(--julia-mono-font-stack);
    font-size: 0.8rem;
    font-variant-ligatures: none;
    padding: 0 0.4rem 0 0.1rem;
}
pluto-logs-container pluto-progress-name:empty {
    padding: 0;
}

pluto-logs-container pluto-progress-bar {
    --c: var(--pluto-logs-progress-fill);
    padding: 0.3em 0.6em;
    background: linear-gradient(90deg, var(--c), var(--c));
    background-repeat: no-repeat;
    transition: background-size cubic-bezier(0.14, 0.71, 0, 0.99) 0.5s, opacity linear 0.2s;
    display: grid;
    align-items: center;
}

pluto-logs-container pluto-progress-bar.collapsed {
    height: 0;
}

pluto-logs {
    display: flex;
    flex-direction: column;
}

pluto-logs:not(:first-child):not(:empty) {
    margin-top: 10px;
}

pluto-log-dot {
    /* part 2 */
    /* box-shadow: -2px 0px 1px #00000014; */
    font-family: var(--roboto-mono-font-stack);
    font-size: 0.6rem;
    position: relative;
    display: flex;
    flex-grow: 1;
    flex-direction: column;
    padding: 1px 3px;
    min-width: 18px;
    min-height: 18px;
    /* border-radius: 7px; */
    padding: 0.6em 0.9em 0.6em 0.3em;
}

pluto-log-dot-positioner {
    /* border-bottom: 1px solid #71717140; */
    display: flex;
    flex-direction: row;
    --bg-color: var(--pluto-logs-info-color);
    --accent-color: var(--pluto-logs-info-accent-color);
    --icon-image: unset;
    background: var(--bg-color);
    margin: 2px;
    border-radius: 6px;
    /* border: 2px solid var(--accent-color); */
    /* border: 2px solid #0000001c; */
    /* box-shadow: 0px 0px 6px #00000036; */
    background: linear-gradient(148deg, var(--bg-color), transparent);
    background-size: 200% 100%;
}

pluto-log-dot > pre {
    color: var(--accent-color);
}

pluto-log-truncated {
    display: grid;
    place-items: center;
    font-family: var(--system-ui-font-stack);
    opacity: 0.7;
    padding: 0.7em;
    font-style: italic;
}

pluto-log-icon::before {
    content: "";
    width: 1em;
    height: 1em;
    background-image: var(--icon-image);
    background-size: 1em;
    filter: var(--image-filters);
    display: inline-flex;
    margin: 0.3em;
}

pluto-log-dot-positioner.Info {
    --icon-image: url("https://cdn.jsdelivr.net/gh/ionic-team/ionicons@5.5.1/src/svg/information-circle-outline.svg");
}
pluto-log-dot-positioner.Info pluto-log-icon::before {
    opacity: 0.4;
}
pluto-log-dot-positioner.Warn {
    --bg-color: var(--pluto-logs-warn-color);
    --accent-color: var(--pluto-logs-warn-accent-color);
    --icon-image: url("https://cdn.jsdelivr.net/gh/ionic-team/ionicons@5.5.1/src/svg/warning-outline.svg");
}
pluto-log-dot-positioner.Error {
    --bg-color: var(--pluto-logs-danger-color);
    --accent-color: var(--pluto-logs-danger-accent-color);
    --icon-image: url("https://cdn.jsdelivr.net/gh/ionic-team/ionicons@5.5.1/src/svg/close-circle-outline.svg");
}
pluto-log-dot-positioner.Debug {
    --bg-color: var(--pluto-logs-debug-color);
    --accent-color: var(--pluto-logs-debug-accent-color);
    --icon-image: url("https://cdn.jsdelivr.net/gh/ionic-team/ionicons@5.5.1/src/svg/information-circle-outline.svg");
}
pluto-log-dot-positioner.Stdout {
    --icon-image: url("https://cdn.jsdelivr.net/gh/ionic-team/ionicons@5.5.1/src/svg/terminal-outline.svg");
}
pluto-log-dot-positioner.Stdout pluto-log-icon::before {
    opacity: 0.4;
}

pluto-log-dot.Progress {
    padding: 0px;
    display: flex;
    flex-direction: row;
    align-items: center;
    align-self: center;
}
pluto-log-dot.Stdout {
    --inner: hsl(36deg 20% 37%);
    --outer: hsl(31deg 12% 28%);
    background: radial-gradient(var(--inner), var(--inner) 20%, var(--outer));
    color: #c0ffab;
    border: 6px solid #b7b7b7;
    text-shadow: 1px 1px 2px #0000005e;
    min-width: 18em;
    border-radius: 8px;
}
pluto-log-dot.Stdout::after,
pluto-log-dot.Stdout::before {
    content: " ";
    left: 0;
    right: 0;
    top: 0;
    bottom: 0;
    position: absolute;
    display: block;
    pointer-events: none;
}
pluto-log-dot.Stdout::before {
    opacity: 0.3;
    background: linear-gradient(349deg, #000000, transparent);
}
pluto-log-dot.Stdout::after {
    --crt-spacing: 7px;
    background: linear-gradient(180deg, hsl(37deg 20% 27%), transparent, #1a1a1a);
    background-size: 100% var(--crt-spacing);
    background-repeat: repeat;
    opacity: 0.2;
    animation: scroll-crt 1s linear infinite;
    animation-play-state: paused;
}
/* To make space in the top right for the info button. */
pluto-log-dot.Stdout pre::before {
    content: " ";
    width: 24px;
    /* float is weird but it does exactly what we want here: take up space or trigger text wrapping only if needed to clear the top right corner. */
    float: right;
}

a.stdout-info {
    position: absolute;
    right: 2px;
    top: 2px;
    z-index: unset;
    pointer-events: initial;
}

@keyframes scroll-crt {
    0% {
        background-position: 0px 0px;
    }
    100% {
        background-position: 0px var(--crt-spacing);
    }
}
@media (prefers-reduced-motion: no-preference) {
    pluto-log-dot.Stdout:hover::after {
        animation-play-state: running;
    }
}
@media (prefers-contrast: more) {
    pluto-log-dot.Stdout::after {
        display: none !important;
    }
}

pluto-log-dot jlerror {
    display: block;
    background: var(--main-bg-color);
    padding: 0.6rem;
    border-radius: 0.5rem;
}
pluto-log-dot jltree,
pluto-log-dot jlpair {
    font-size: 0.6rem;
}
pluto-log-dot > img {
    max-width: 100px;
}

pluto-log-dot-kwarg {
    display: flex;
    flex-wrap: wrap;
    flex-direction: row;
}
pluto-log-dot-kwarg > * {
    flex: 0 1 auto;
}
pluto-log-dot-kwarg > pluto-key {
    color: var(--pluto-logs-key-color);
    margin-right: calc(1em - 30px);
}
pluto-log-dot-kwarg > pluto-key::after {
    content: ": ";
}
pluto-log-dot-kwarg > pluto-value {
    margin-left: 30px;
    overflow-x: auto;
}
/* PRESENTATION MODE */

body.presentation pluto-output h1,
body.presentation pluto-output h2 {
    margin-top: 100vh;
}
body.presentation pluto-notebook {
    padding-bottom: 100vh;
}
body.presentation #helpbox-wrapper,
body.presentation footer {
    display: none !important;
}

nav#slide_controls {
    display: none;
}
body.presentation nav#slide_controls {
    display: flex;
    position: fixed;
    bottom: 0px;
    right: 0px;
    z-index: 100;
}

nav#slide_controls > button {
    position: static;
    padding: 5px;
}

button.floating_back_button > span::after,
nav#slide_controls > button > span::after {
    content: " " !important;
    display: block;
    height: 30px;
    width: 30px;
    background-size: 30px 30px;
}
button.floating_back_button > span::after,
nav#slide_controls > button.prev > span::after {
    background-image: url("https://cdn.jsdelivr.net/gh/ionic-team/ionicons@5.5.1/src/svg/arrow-back-outline.svg");
    filter: var(--image-filters);
}
nav#slide_controls > button.next > span::after {
    background-image: url("https://cdn.jsdelivr.net/gh/ionic-team/ionicons@5.5.1/src/svg/arrow-forward-outline.svg");
    filter: var(--image-filters);
}

button.floating_back_button {
    display: flex;
    position: fixed;
    z-index: 1000;
    left: 1em;
    top: 1em;
}

/* CODEMIRROR HINTS */

.cm-editor .cm-tooltip {
    border: 1px solid var(--cm-color-editor-tooltip-border);
    box-shadow: 3px 3px 4px rgb(0 0 0 / 20%);
    border-radius: 4px;
}

.cm-tooltip-lint {
    font-family: "JuliaMono";
    font-size: 0.75rem;
    z-index: 100;
}

.cm-tooltip-autocomplete {
    max-height: calc(20 * 16px);
    box-sizing: content-box;
    z-index: 100;
}

.cm-tooltip.cm-completionInfo.cm-completionInfo-right:empty {
    /* https://github.com/codemirror/codemirror.next/issues/574 */
    display: none;
}

.cm-editor .cm-tooltip.cm-tooltip-autocomplete > ul > li {
    /* this is the line height rounded to an integer to prevent jiggle */
    height: 16px;
    overflow-y: hidden;
    /* font-size: 16px; */
    line-height: 16px;
    border-radius: 3px;
}
pluto-input .cm-editor .cm-tooltip.cm-tooltip-autocomplete > ul > li {
    height: unset;
}

.cm-editor .cm-tooltip.cm-tooltip-autocomplete > ul > li[aria-selected] {
    color: var(--cm-color-editor-li-aria-selected);
    background: var(--cm-color-editor-li-aria-selected-bg);
}
.cm-editor .cm-tooltip.cm-tooltip-autocomplete > ul > li[aria-selected] .cm-completionLabel {
    border-color: transparent;
}
.cm-editor .cm-tooltip.cm-tooltip-autocomplete > ul > li .cm-completionDetail {
    float: right;
    margin-right: 0.5em;
    font-size: 0.8em;
    font-family: var(--julia-mono-font-stack);
    font-style: normal;
}

.cm-editor .cm-tooltip.cm-tooltip-autocomplete li.c_notexported {
    color: var(--cm-color-editor-li-notexported);
}

.cm-editor .cm-completionIcon {
    opacity: 1;
    width: 1em;
    transform: translateY(-1.5px);
}

.cm-completionIcon::before {
    /* TODO This loses all color when it's not font-family: JuliaMono, which can happen */
    content: "⚫";
    font-family: var(--julia-mono-font-stack) !important;
    color: transparent;
    font-size: 0.75rem;
    margin-right: 0.5em;
    opacity: 1;
}

/* CODEMIRROR STYLE */

/*
Based on "Paraíso (Light)" by Jan T. Sott:
    Color scheme by Jan T. Sott (https://github.com/idleberg/Paraiso-CodeMirror)
    Inspired by the art of Rubens LP (http://www.rubenslp.com.br)
*/

[data-pluto-variable] {
    /* text-decoration-thickness: 3px; */
    font-weight: inherit;
}

[data-pluto-variable],
[data-pluto-variable]:hover,
.cm-editor .cm-tooltip.cm-tooltip-autocomplete li.c_from_notebook .cm-completionLabel {
    font-weight: bold;
    text-decoration: underline;
    text-decoration-color: var(--cm-color-clickable-underline);
    text-decoration-thickness: 3px;
    text-decoration-skip-ink: none;
}

pluto-editor.disable_ui [data-pluto-variable],
pluto-editor.disable_ui [data-cell-variable] {
    cursor: pointer;
}
pluto-editor:not(.disable_ui) [data-ctrl-down="true"][data-pluto-variable],
pluto-editor:not(.disable_ui) [data-ctrl-down="true"][data-cell-variable] {
    text-decoration-color: #d177e6;
    cursor: pointer;
}
pluto-editor:not(.disable_ui) [data-ctrl-down="true"][data-pluto-variable]:hover,
pluto-editor:not(.disable_ui) [data-ctrl-down="true"][data-pluto-variable]:hover * {
    /* This basically `color: #af5bc3`, but it works for emoji too!! */
    color: transparent !important;
    text-shadow: 0 0 #af5bc3;
}

/* Variable that is declared in the same cell */
[data-cell-variable] {
    /* Can give this cool styles later as well, but not for now nahhh */
    text-decoration: none;
}
[data-ctrl-down="true"][data-cell-variable]:hover * {
    /* This basically `color: #af5bc3`, but it works for emoji too!! */
    color: transparent !important;
    text-shadow: 0 0 #af5bc3;
}

.cm-tooltip.cm-tooltip-autocomplete {
    padding: 0;
    margin-left: -1.5em;
    background: var(--autocomplete-menu-bg-color);
}

pluto-input .cm-editor .cm-scroller {
    overflow-y: hidden;
}

pluto-input .cm-editor .cm-content,
pluto-input .cm-editor .cm-scroller,
.cm-editor .cm-tooltip-autocomplete .cm-completionLabel {
    font-family: var(--julia-mono-font-stack) !important;
    font-variant-ligatures: none;
    font-size: 0.8rem;
}

pluto-input .cm-editor .cm-content {
    padding: 2px 0px;
}

.cm-editor .cm-scroller > .cm-selectionLayer .cm-selectionBackground {
    background: var(--cm-selection-background-blurred);
}
.cm-editor.cm-focused .cm-scroller > .cm-selectionLayer .cm-selectionBackground {
    background: var(--cm-selection-background);
}

.cm-editor {
    background: var(--code-background);
    color: var(--cm-color-editor-text);
}
.cm-editor.cm-focused:not(.__) {
    outline: unset;
}

.cm-editor .cm-gutter {
    min-width: 31px;
    min-height: 23px;
}

.cm-editor .cm-gutters {
    /* background: hsla(46, 90%, 98%, 1); */
    background: transparent;
    border-right: solid 1px hsla(0, 0%, 0%, 0);
    /* height: auto; */
}

pluto-cell.code_differs > pluto-input > .cm-editor .cm-gutters {
    /* background: hsla(46, 70%, 88%, 1); */
    background-color: var(--cm-color-code-differs-gutters);
}

/* We show a small dot instead of line number, until you hover. */
.cm-editor .cm-lineNumbers .cm-gutterElement {
    color: transparent;
}
.cm-editor .cm-lineNumbers .cm-gutterElement::after {
    content: "⋅";
    font-size: 0.75rem;
    color: var(--cm-color-line-numbers);
    position: absolute;
    right: 3px;
    pointer-events: none;
}
.cm-editor .cm-lineNumbers .cm-gutterElement:hover {
    color: var(--cm-color-line-numbers);
}
.cm-editor .cm-lineNumbers .cm-gutterElement:hover::after {
    color: transparent;
}

/* Disabling this feature in two cases: */
/* Case 1: The cell input is in focus */
/* pluto-input:focus-within .cm-editor .cm-lineNumbers .cm-gutterElement {
    color: var(--cm-color-line-numbers);
}
pluto-input:focus-within .cm-editor .cm-lineNumbers .cm-gutterElement::after {
    color: transparent;
}
 */

pluto-cell.errored > pluto-input > .cm-editor .cm-lineNumbers .cm-gutterElement {
    color: var(--cm-color-line-numbers);
}
pluto-cell.errored > pluto-input > .cm-editor .cm-lineNumbers .cm-gutterElement::after {
    color: transparent;
}
/* Case 2: Print */
@media print {
    .cm-editor .cm-lineNumbers .cm-gutterElement {
        color: var(--cm-color-line-numbers) !important;
    }
    .cm-editor .cm-lineNumbers .cm-gutterElement::after {
        color: transparent !important;
    }
}

.cm-completionIcon-c_Number::before {
    color: var(--cm-color-literal);
}

.cm-completionIcon-c_String::before,
.cm-completionIcon-completion_path::before,
.cm-completionIcon-completion_dict::before {
    color: var(--cm-color-string);
}

.cm-completionIcon-completion_property::before {
    color: var(--cm-color-symbol);
}

.cm-completionIcon-completion_keyword::before {
    color: var(--cm-color-keyword);
}

li.completion_keyword_argument .cm-completionLabel {
    font-style: italic;
    font-weight: bold;
}
.cm-completionIcon-completion_keyword_argument::before {
    color: var(--cm-color-literal);
}

.cm-completionIcon-c_Any::before,
pluto-output > assignee,
pluto-popup code.auto_disabled_variable {
    color: var(--cm-color-variable) !important;
    font-weight: 700;
}

.cm-completionIcon-c_Function::before {
    color: var(--cm-color-function);
}
.cm-completionIcon-c_Macro::before {
    color: var(--cm-color-macro);
}

.cm-completionIcon-c_Array::before {
    color: var(--cm-color-bracket);
}

.cm-completionIcon-c_package::before,
.cm-completionIcon-c_Module::before {
    color: var(--cm-color-link);
}

.cm-editor .cm-activeLine {
    background: unset;
}

.cm-selectionMatch {
    background: none !important;
    text-shadow: 0 0 8px rgba(0, 0, 0, 0.5);
}

@media (prefers-color-scheme: dark) {
    .cm-selectionMatch {
        background: none !important;
        text-shadow: 0 0 8px rgba(255, 255, 255, 0.5);
    }
}

.cm-editor .cm-matchingBracket,
.cm-editor .cm-nonmatchingBracket {
    background-color: unset;
    color: unset;
}
pluto-input:focus-within .cm-editor .cm-matchingBracket {
    color: var(--cm-color-matchingBracket) !important;
    font-weight: 700;
    background-color: var(--cm-color-matchingBracket-bg);
    border-radius: 2px;
}

.cm-editor .cm-placeholder {
    color: var(--cm-color-placeholder-text);
    font-style: italic;
}

.cm-completionMatchedText {
    text-decoration: unset !important;
}

/* Required for awesome-line-wrapping-plugin */
.awesome-wrapping-plugin-the-line {
    --correction: 0px;
    margin-left: calc(var(--indented));
    text-indent: calc(-1 * var(--indented));
}
.awesome-wrapping-plugin-the-line > * {
    /* text-indent apparently cascades... which I think is pretty stupid but this is the fix */
    text-indent: initial;
}
.awesome-wrapping-plugin-the-tabs {
    /* So FOR SOME REASON text-ident is kinda buggy
        but that gets fixed with inline-block...
        But that brought some other problems...
        But margin-left: -1px seems to also do the trick?? */
    /* display: inline-block; */
    white-space: pre;
    vertical-align: top;
    margin-left: -1px;
}

/* PLUTO HOOKS - special styling for cell that runs hook */
/* New feature, new section in the css! */
pluto-cell.hooked_up {
    --pluto-cell-force-color: #00b9ff7a;
}

pluto-cell.hooked_up > pluto-trafficlight {
    background-color: var(--pluto-cell-force-color) !important;
}

pluto-cell.hooked_up > pluto-input .cm-editor {
    border-color: var(--pluto-cell-force-color);
    border-width: 2px;
    border-left: none;
    border-top: none;
}

pluto-cell.hooked_up > pluto-runarea {
    opacity: 1;
    background-color: var(--pluto-cell-force-color);
}

pluto-cell.hooked_up > pluto-runarea > span {
    color: #0000004f;
}

pluto-cell.hooked_up > pluto-output {
    border-right: solid 2px;
    border-top: solid 2px;
    border-top-right-radius: 4px;
    border-bottom: solid 2px;
    border-color: var(--pluto-cell-force-color);
}

.fm-table {
    display: grid;
    grid-template-columns: auto 1fr min-content;
    gap: 0.3em 1em;
}

/* Frontmatter input and Project.toml editor */

.pluto-modal {
    font-family: var(--system-ui-font-stack);
    width: min(31rem, 90vw);
    color: var(--export-color);
    background: var(--export-bg-color);
    border-radius: 1.8em;
    padding: 1.3em 1.9em;
    border: none;
    box-shadow: 0 0 55px #00000052;
}
.pluto-modal h1 {
    color: white;
    font-weight: 900;
    margin-block-start: 0.3em;
}

.pluto-modal :is(a) {
    color: var(--export-color);
    text-decoration-color: var(--export-color);
}

.pluto-modal button {
    cursor: pointer;
    background-color: var(--frontmatter-button-bg-color);
    border-radius: 0.5em;
    border: 2px solid var(--frontmatter-button-bg-color);
    font-weight: 500;
}

.pluto-modal button:hover {
    border-color: var(--frontmatter-input-border-color);
}

.pluto-modal input {
    background-color: var(--frontmatter-input-bg-color);
    border-radius: 0.5em;
    border: 2px solid var(--frontmatter-input-border-color);
    padding: 0.3em 0.5em;
}
.pluto-modal label {
    font-weight: 500;
}

.pluto-modal .final {
    display: flex;
    margin-top: 0.5rem;
    justify-content: flex-end;
    gap: 0.5em;
}

.pluto-frontmatter .card-preview {
    background: var(--white);
    padding: 1.2rem 1.1rem;
    margin: 1rem 0;
    box-shadow: inset 0px 0px 15px -4px #00000054;
    border-radius: 1rem;
}

.pluto-frontmatter .card-preview > h2 {
    margin-block-start: 0;
    color: var(--black);
}

.pluto-frontmatter input:invalid {
    outline-color: red;
    border-color: red;
}

.pluto-frontmatter rbl-tag-input {
    color: var(--black);
}

.pluto-frontmatter .deletefield {
    color: var(--export-color);
    background-color: transparent;
    border-width: 0;
    align-self: stretch;
    margin-left: -1em;
}

.pluto-frontmatter .addentry {
    grid-column: 1/3;
    margin-top: 0.5em;
}

.pluto-frontmatter fieldset {
    grid-column: 1/4;
}

.pluto-frontmatter .final {
    margin-top: 2rem;
}

.pluto-project_toml {
    width: min(45rem, 90vw);
}

.pluto-project_toml .cm-editor {
    font-family: var(--julia-mono-font-stack);
    margin-block-end: 2rem;
}

/*  Styles for markdown copy Button*/
.markdown-code-block-button {
    position: relative;
    cursor: pointer;
    justify-content: center;
    align-items: center;
    display: block;
    padding: 0;
    float: right;
    border: none;
    background: none;
}

.markdown-code-block-button::before {
    content: "";
    display: block;
    width: 14px;
    height: 14px;
    filter: var(--image-filters);
}

.markdown-code-block-button::before {
    background-image: url("https://cdn.jsdelivr.net/gh/ionic-team/ionicons@5.5.1/src/svg/copy-outline.svg");
    background-size: 100% 100%;
}

.markdown-code-block-button.recently-copied::before {
    background-image: url("https://cdn.jsdelivr.net/gh/ionic-team/ionicons@5.5.1/src/svg/checkmark-outline.svg");
}

/* Styles for markdown header ID copy button */
pluto-header-id-copy {
    position: relative;
    cursor: pointer;
    justify-content: center;
    align-items: baseline;
    display: inline-block;
    padding: 0;
    margin-inline-start: 0.2em;
    border: none;
    background: none;
    transition: opacity 0.1s ease;
    font-size: inherit;
    inset-block: 0.1em;
    opacity: 0.3;
}

pluto-header-id-copy::before {
    content: "";
    display: block;
    --size: 0.7em;
    width: var(--size);
    height: var(--size);
    filter: var(--image-filters);
    background-image: url("https://cdn.jsdelivr.net/gh/ionic-team/ionicons@5.5.1/src/svg/link-outline.svg");
    background-size: 100% 100%;
}

pluto-header-id-copy-wrapper {
    display: inline-block;
    width: 0;
}

pluto-header-id-copy.recently-copied::before {
    background-image: url("https://cdn.jsdelivr.net/gh/ionic-team/ionicons@5.5.1/src/svg/checkmark-outline.svg");
}

@media (pointer: fine) {
    pluto-header-id-copy {
        opacity: 0;
    }
}

/* Show button on header hover */
pluto-output :is(h1, h2, h3, h4, h5, h6):hover pluto-header-id-copy {
    opacity: 0.3;
}

pluto-output:hover pluto-header-id-copy:hover {
    opacity: 1;
}

/* Show button when focused */
pluto-header-id-copy:focus {
    opacity: 1;
    outline: 2px solid var(--black);
    outline-offset: 2px;
}

jlerror.syntax-error > header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.fix-with-ai {
    display: inline-flex;
    gap: 8px;
    align-items: center;
}

.fix-with-ai button {
    font-family: var(--system-ui-font-stack);
    font-size: 0.8rem;
    font-weight: 500;
    padding: 4px 12px;
    border-radius: 6px;
    border: none;
    color: var(--black);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--ai-gradient-bg);
    transition: background 0.3s ease;
}

.fix-with-ai button::before {
    content: "";
    display: inline-block;
    width: 1.2em;
    height: 1.2em;
    background-size: contain;
    filter: var(--image-filters);
    transition: background-image 0.3s ease;
}

.fix-with-ai button::before {
    background-image: url("https://cdn.jsdelivr.net/gh/ionic-team/ionicons@5.5.1/src/svg/sparkles.svg");
}

.fix-with-ai-loading button {
    background: linear-gradient(135deg, rgba(65, 105, 225, 0.1), rgba(147, 112, 219, 0.1));
}

.fix-with-ai-loading button::before {
    background-image: url("https://cdn.jsdelivr.net/gh/ionic-team/ionicons@5.5.1/src/svg/sync-outline.svg");
    animation: identifier-spin 1s linear infinite;
}

.fix-with-ai-success button {
    background: rgb(89 174 87 / 22%);
}

.fix-with-ai-success button::before {
    background-image: url("https://cdn.jsdelivr.net/gh/ionic-team/ionicons@5.5.1/src/svg/caret-forward-circle-outline.svg");
}

.fix-with-ai button.reject-ai-fix {
    background: rgba(231, 71, 71, 0.228);
}

.fix-with-ai button.reject-ai-fix::before {
    background-image: url("https://cdn.jsdelivr.net/gh/ionic-team/ionicons@5.5.1/src/svg/close-outline.svg");
}

.ai-permission-prompt {
    padding: 0.2em;
}

.ai-permission-prompt h3 {
    margin-top: 0;
    margin-bottom: 1rem;
}
/* 
.ai-permission-prompt p {
    margin-bottom: 1.5rem;
    line-height: 1.4;
} */

.ai-permission-prompt .ask-next-time {
    display: flex;
    gap: 0.5ch;
    margin-bottom: 1em;
}

.ai-permission-prompt .button-group {
    display: flex;
    gap: 0.75rem;
}

.ai-permission-prompt button {
    padding: 0.5rem 1rem;
    border-radius: 4px;
    border: 1px solid var(--pluto-output-color);
    background: var(--white);
    color: var(--black);
    cursor: pointer;
    font-size: 0.9rem;
}

.ai-permission-prompt button.accept {
    background: var(--black);
    color: var(--white);
}
